It’s a shame this poster never got a more detailed answer after all this time. It’s a good question.
I’ve found my safest foods are very limited: raw salads and red meat. Meat and insoluble fibre don’t feed bacteria as much as soluble fibre and just about everything else. Red meat also has the advantage of containing fats, which also help move things along.
The very worst foods for me are high starch – all grains: wheat, rice etc – there’s no safe grain for me, FODMAPs, sugar etc. I think constipation underlies all IBS but this doesn’t necessarily mean you don’t go every day. You could have a sluggish form of constipation where food residue moves slowly through the colon, feeding bacteria as it does so. Eventually if the bacterial populations grows large enough, it can migrate up towards the small intestine. Raw salads seem to move quickly through for me and the soluble fibre in salads is metabolised to some extent by colonic bacteria I believe, not by bacteria in the small intestine. I also think mostly starch is broken down in the small intestine, so if your symptoms are worse after you eat a lot of starch, this might suggest a problem with SIBO. I can’t eat any FODMAPs, and these include all legumes. We’re all different so it’s just trial and error with diet. It took me 10 years to work out my optimum diet. I’ve kept a lot of diaries over these years and these have helped me determine what works and what doesn’t.