Background: Emerging evidence suggested that the gut microbiota associated with the development of immune-related adverse effects (irAEs) among cancer patients receiving immune checkpoint inhibitors (ICIs), but their roles remain largely unknown, and the causal associations are yet to be clarified. Methods: Bi-directional two-sample Mendelian randomization (MR) approach was employed to examine the potential causal relationship between the gut microbiome and irAEs (high-grade irAEs and all-grade irAEs). Instrumental variables (IVs) for gut microbiota were retrieved from the MiBioGen consortium (18,340 participants). GWAS summary data for instrument-outcome associations were gathered from an ICIs-treated cohort with 1,751 cancer patients. Inverse variance weighted (IVW), MR PRESSO, maximum likelihood (ML), weighted median, weighted mode, and cML-MA-BIC were used in the MR analysis. Reverse MR analysis was performed on the identified bacteria that were causally associated with irAEs. Results: Fourteen gut bacterial taxa identified by IVW and MR PRESSO were causally associated with irAEs, among which Lachnospiraceae was shown to increase the risk of both high-grade and all-grade irAEs. Akkermansia, Verrucomicrobiaceae, and Anaerostipes were found to exert protective roles in high-grade irAEs. Nevertheless, Ruminiclostridium6, Coprococcus3, Collinsella, and Eubacterium (fissicatena group) predispose to the development of high-grade irAEs. For all-grade irAEs, RuminococcaceaeUCG004, and DefluviitaleaceaeUCG011 were shown to have protective effects. While on the contrary, Porphyromonadaceae, Roseburia, Eubacterium (brachy group), and Peptococcus were associated with an elevated risk of all-grade irAEs. Conclusion: Our MR analysis found that Lachnospiraceae and Akkermansia et al. were causally associated with the development of irAEs, which warrants further investigation.