This study aimed to explore the causal link between the gut microbiota and periodontitis, and to delineate and quantify the intermediary role of immune cells, so as to provide new insights into the pathogenesis, prevention and treatment of periodontitis. We employed a two-sample Mendelian randomization (MR) approach to analyze the genetic predictors of gut microbiota composition (covering 412 gut microbiota taxa and functions) and periodontitis (involving 4,784 cases and 272,252 controls) derived from genome-wide association study (GWAS) datasets. A subsequent two-step MR analysis was conducted to evaluate the extent to which immune cell traits (encompassing 731 immune cell characteristics) mediate the influence of gut microbiota on periodontitis risk. Our analysis implicated nine gut microbiota taxa as causal factors in periodontitis susceptibility (p < 0.05). Notably, the Genus Roseburia was identified as exerting a protective effect against periodontitis, partially mediated through the upregulation of CD86 expression on granulocytes, with an 8.15% mediation effect observed. Our findings establish a causal relationship between the gut microbiota and periodontitis, highlighting the protective role of Roseburia against this condition. A notable proportion of this protective effect is mediated via the upregulation of CD86 on granulocytes. It can provide new ideas for the pathogenesis, prevention and treatment for periodontitis through exploring the causal link between the gut microbiota and periodontitis, and describing and quantifying the intermediary role of immune cells.