Same error, and it works for me.
run softwareupdate --install-rosetta and re-open Xcode.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: