Conditionally run program using Rosetta 2 on M1 Mac

You can use the arch command to force a preferred slice loading order for universal binaries. In your particular case, you would first make sure to Get Info on Xcode and uncheck the "Open using Rosetta" checkbox in Finder. Then via command line you can force loading the x86_64 slice:

arch -x86_64 /Applications/Xcode.app/Contents/MacOS/Xcode

See man arch for more details.