ABSTRACT Background A relationship may exist between the gut microbiota, inflammatory factors, and irritable bowel syndrome (IBS); however, the precise biological mechanisms linking these components remain uncertain. Methods In this study, 211 single‐nucleotide polymorphisms associated with the gut microbiota were collected from the MiBioGen consortium. Summary data for IBS were sourced from large‐scale genome‐wide association studies. Two‐step Mendelian randomization ( MR ) was applied to estimate the possible mediating effect of inflammatory cytokines on the causality between the gut microbiota and IBS . Results MR confirmed the effects of class Melainabacteria, genus Eubacterium hallii group, order Gastranaerophilales, order Rhodospirillales, family Lachnospiraceae, genus Eisenbergiella on IBS prevention. Moreover, MR revealed the role of CD40L receptor levels, interleukin‐18 receptor 1 levels, interleukin‐1‐alpha levels, neurturin levels, neurotrophin‐3 levels, stem cell factor levels, signaling lymphocytic activation molecule levels, transforming growth factor‐alpha levels, TNF ‐beta levels, tumor necrosis factor ligand superfamily member 12 levels in IBS . The mediation exploration indicated that the indirect effect of class Melainabacteria ( FCS020 group) (id: 11,314) on IBS mediated by Tumor necrosis factor ligand superfamily member 12 levels was OR 1.003 (95% confidence interval 1.000–1.009; mediation proportion = 3.846%). Conclusions This study supplies genetic insights into the potential causal association between the gut microbiota and IBS . These causal associations and mediating effects are helpful in managing IBS through manipulation of the gut microbiota.