If you fuck up.... That's okay! It happens.
What you need to do then is legitimately apologise, actually understand where you went wrong, and then fix it. Make a legit effort to learn and fix it.
You get called racist? We are all unlearning generations of racism. Just admit it, apologize, learn why it was racist, and correct yourself.
No need to make a scene. No matter how embarrassed you are.
Just apologize and move on. You can gush about your embarrassment later, after you patched it over.