Hey Mike,
The idea of a hard tail xs400 has crossed my mind before too. But the xs650 hard tail kits cost more to freight into Australia than they do to actually buy them.. so I didn't bother. Now, I'm onto my third Yamaha XS, First was 250, 2nd is a 400 still in build stages, and the third is an xs750 which I'm close to finishing. Now I'm not a motorcycle guru or anything.. far from it.. I'm just a bike nut, but particularly love the XS's... especially the 400.
My advice to you would be this, obtain the dimensions of the hard tail from the supplier, you will need the girth across the top as well as the girth between the bottom weld points. You will also want the inside width between the axle tabs. Then obviously just find the best points on the XS400 frame that is close to the 650 rigid width. (get the internal width between the tube, as opposed to center-center) It's easier to measure when dealing with cut/hollow tube).
The XS650 crank case is only just a fraction wider than the 400 case i believe, so the bottom rails should be close, you may need to push the 400 bottom out just a tad to mate up to the 650 rigid bottom rails.
The main concern with the swap is this though, the 650 rigid rear is designed to weld on to the 650 top tube, which is a single tube. On the XS400, it has a main top tube AS WELL AS two lower straight supports, which all three tubes then meet up to a cross member underneath the where the tank bolts up. You will have to cut the cross member out then extend and mitre the lower top tubes to mate up to the rigid rear. I will draw you a diagram if you want and pop it on photobucket for you. Just let me know. The other problem is the rear wheel width. The 1981 XS650SH had the same cast wagon wheels that the 400 had, so I have just cross-referenced all the OEM numbers between the 2 models.. and the OEM #'s were different for the the actual wheel, the brake plate, the wheel spacers and dust covers and axle, which would indicate they were physically different. You can use your xs400 wheel and all the other gear, but am unsure about the 650 rear axle diamter. The TX650 had a 17mm rear axle, same as the 400, and Yamaha being Yamaha.. possibly re-used the TX650 parts on the XS650.... So if the 650 axle is also 17mm you're sweet
In which case it would just be a matter of getting the wheel centered, and a straight-edge to line up the sprockets, then have new axle spacers turned up at the local metal shop to meet the new width (if that's even necessary). But you really won't know much until you decide which hard tail model you want to use, then contact the manufacturer/supplier and get the internal widths for the rear frame.. then go from there. PM or email me if you want some help mate
Cheers
p.s. could you please post a pic of the model rear you want to use? There's like 5-6 different styles available LOL 8)