Thank you so much for this question.
There many ways to handle a situation where someone is backbiting in front of you.
1- Say Something Good
When someone says something bad about someone else, say something good about this same person immediately.
Whenever they speak badly about someone, find anything good in that person and keep mentioning it until those who backbite realize you’re not aiding them in the backbiting and they stop.
2- Be Direct
If someone comes and tells you that they want to tell you a story, ask them, does it involve talking about someone by name, or referring to them clearly so that I would know who they are?
If they say yes or maybe, you can then say: then, please, may Allah reward you, but I don’t want to know.
If they insist and say, but I’m not saying anything wrong. I just wanted to tell you a story that really happened. I don’t mean anything and I’m not lying against them, this really happened: you can then say, I know. May Allah reward you. But please I do not want to talk about anyone in their absence. I really don’t want to know this story. Thank you.
Then change the subject and talk about anything else.
3- Change the Subject
Remember to change the subject whenever someone starts backbiting.
You need to kill the backbiting before it evolves. It evolves because you accepted it and allowed it to evolve. Instead, start talking about something else.
For example, remember a tafseer of a beautiful verse you heard, or a meaning of a hadith or an inspirational reflection. So, stop the wrong, but replace it with something good so that people won’t feel so bitter about it and become occupied with the new beautiful good and pure discussion.
4- Remove Yourself from the Situation
Don’t be shy to ask people to stop backbiting with you/in front of you. Have pride in your religion and its beautiful teachings that guide us to what’s pure and forbid us from what’s harmful. You can simply go sit somewhere else, away from their backbiting.
You don’t have to submit to people when they are doing something wrong. You can change the subject. Talk about the person in a very good way instead. Or simply walk away.
There are so many ways to avoid people backbiting in front of you. Be creative, save yourself and others from this sin. Jannah is worth it. The major sins that come out of this sin in this life and the next deserve to be fought against with all your heart, mind, and creativity. Also check out this post on how to stop backbiting.
I hope this helps. Please keep in touch.
Please continue feeding your curiosity, and find more info in the following links: