In the USA how is it not discriminatory for a hospital to reassign a nurse based on a patient’s preference of race or gender?

It is discriminatory in many cases.

That said, as other commenters have said, there are people who can have trauma related reasons- and I’ll throw out there, as someone who’s very close to several nurses- it’s a complete waste of everyone’s time to try to morally police patients when a nurse’s patient load is already insane.