BackgroundNumerous studies have highlighted the close association between gut microbiota and the development of ulcerative colitis (UC), yet research on whether immune cells mediate this process remains scarce. This study utilizes various Mendelian randomization (MR) methods to investigate the causal relationship between gut microbiota and UC, further exploring the mediating role of immune cells in this process.MethodsGenome-wide association study (GWAS) summary statistics for 473 gut microbiota, 731 immune cell phenotypes, and UC were obtained from the GWAS catalog database. Single nucleotide polymorphisms (SNP) were used as instrumental variables (IV) to validate the causal relationship between gut microbiota and UC through two-sample MR and Bayesian weighted MR (BWMR), and reverse MR was employed to explore the presence of reverse causal effects. Two-step MR was applied to identify immune cell mediators and evaluate their mediation effects.ResultsThe study revealed a causal relationship between 20 gut microbiota and UC, with 14 microbiota acting as protective factors for UC and 6 as risk factors. Mediation MR identified 26 immune cell mediators, among which the association between CD11b on Mo MDSC and Bifidobacterium bifidum (B. bifidum) was most significant (p = 0.0017, OR = 1.4540, 95% CI: 1.1504–1.8378). Mediation MR analysis indicated that the mediation effect of CD11b on Mo MDSC between B. bifidum and UC was −0.0385, with a mediation effect ratio of 16.67%.ConclusionThere is a clear causal relationship between certain gut microbiota and UC, and CD11b on Mo MDSC is a significant mediator between B. bifidum and UC, providing new insights for the clinical treatment of UC.