It sounds like social anxiety. My guess is that maybe this happened a few times, you became self conscious of it, and it became a social anxiety that continues because you are worried that it will happen.
Anxiety has a huge effect on the gut.
Maybe try to speak to a psychiatrist and start a low dose of anti-anxiety medication.
If you want to go the natural route, there are things like holy basil and calming teas that you can try.
Once you get the anxiety under control, i have a feeling the farting will stop.