There's a complicated way, a cheaty way and an easy way.
The complicated way relies on the fact that post-abandonment item scatter apparently takes item weight into account. Heavier items are scattered less, lighter items more. So by putting desirable items inside heavy containers like lead bins means the container and contents won't move much from their location at abandon.
The cheaty way is to use one of the DFHack commands to declare the fort a "lair", which prevents all scattering. Check your DFHack documentation if you have it installed.
The easy way is possibly another type of bug/feature abuse, but it's really simple: items which were "inside" a building will not scatter when the fort is abandoned. If you simply forbid your dwarfs to take the sword out of the forge after it's been made, it will remain there and can be retrieved from the forge directly when you visit. You can do this by not allowing the desired items on any stockpile, but also by directly forbidding the item inside the building. You must make sure the item's actually "inside" and not "on top of" the building itself: it must be listed when checking building contents via "t" but should not be visible when looking for items on the ground via "k".