There is a diet created by Monash University researchers called the Low FODMAP diet. Essentially FODMAPs are harder to digest sugars that exacerbate GI symtpoms, like farts and cramps. Most people won't see or feel much of a difference but those with GI issues (or those with a fart journal) may see a difference with the diet
However it is a rather strict diet to keep at first until you start reintroducing foods to figure out which foods cause the gas, so I would only recommend it if the gas is extreme or there is cramping or other GI related symtpoms.
I was on the diet for over a year by recommendation of a gastroenterologist and can confirm that after some time the farts were kinda rare and not the smelly kind. But like others have mentioned, farts are natural and cannot be eliminated.
I REALLY wish FODMAP worked for me. I hear everyone raving about it, but may of the "safe" foods aren't safe for me, even in their tiny amounts, and non safe foods are fine. sigh
Fun tidbit. My kid, the first time they realized they farted ran up to me in scared confusion and confessed to me that they burped out of their butt. After learning everyone does and they did before but didn't remember life was ok again