You need access to the innards of the PC in order to jerry-rig it to perform the task. Make the win98 HD(the one you want as) as master and connect it hanging outside of the PC for now. Disconnect the XP one for now, entirely but leave in place. Now, mount the pgm. KILLDISK or DBAN CD, having been burn to CD. All done from the .ISO file obtained. Boot and use the pgm. to wipe clean that HD. Once done, return the XP HD you left disconnected, reconnect. Mount the just cleaned HD, using master&slave setup. When you boot, the XP system should see a new HD, you then want to re-format or prepare that HD for use. Under disk management, do so and as FAT32. Once that process is done, you can reboot to assure all is OK. If OK, then install the Win98 install disc and be sure you direct its install to that newly formatted HD. During this time under XP OS, it should see all after being done and show a new boot menu, "which OS to boot" when finished upon next boot.
Sometimes, its better to install the OLDER windoze 1st, but with XP is just a PITA no matter how things are done, IMHO. So, take that into consideration if the above info doesn't work. Of course, back-up or safeguard data if needed before doing anything.
I have two identical computers and would like to install the hard drive from one into another and run one hard drive as a master using xp os and reformat the other hard drive in fat32 to run windows 98 so I can run some old classic games using one computer. Is this possible and if so how do I do it