How do I gain back my friend without ruining my reputation?

Well let's just say my friends (counting me it's 5 of us) can be inconsiderate with their awful jokes about Middle Eastern people. We've been friends since our Freshman year of HS and it's not the first time they've bullied others.

I confess to being guilt of playing a minor role by participating sometimes and forcing a laugh in order to not look bad in front of them. Anyway they once caught me having lunch with my then friend (Labanese-American) but I noticed them and excused myself. I lied that I was only pretending to befriend her.

Well what happened last month is my friend accidentally overheard me with my friends making jokes about Middle Eastern people and me saying ''I'm only using that Middle Eastern girl, I have to wash my hands afterwards anyway''.

I lost my friend obviously and now her and her family considered me a liar, a racist, etc. The thing is I tend to act nicer when the crowd isn't around. If it was just me, I won't mind but I'm going to look bad, my reputation will plummet and they would think I'm a loser for hanging out or dating someone from the Middle East or with Middle Eastern ancestry. Though I do feel awful for my participation. Any way to gain back her friendship without ruining my reputation?

Updates
9 mo
I'm nicer when I'm alone and the crowd isn't there.
How do I gain back my friend without ruining my reputation?
Post Opinion