Recent studies have suggested an association between gut microbiomes (GMs) and epilepsy. However, the GM taxa identified in different studies are variable. In addition, observational studies cannot indicate causality. Therefore, our study aimed to explore the causal association of GMs with epilepsy and identify the most influential GM taxa. We conducted a Mendelian randomization (MR) study using summary statistics from genome-wide association studies (GWAS) of 211 GM taxa and epilepsy. The GWAS summary statistics for 211 GM taxa (from phylum to genus level) were generated by the MiBioGen consortium, while the FinnGen consortium provided the GWAS summary statistics for epilepsy. The primary analytical method to assess causality was the inverse-variance weighted (IVW) approach. To complement the IVW method, we also applied four additional MR methods: MR-Egger, weighted median, simple mode, and weighted. In addition, we conducted sensitivity analyses using Cochrane's Q-test, MR-Egger intercept test, MR-PRESSO global test, and leave-one-out analysis. We evaluated the causal effect of 211 GM taxa (from phylum to genus level) on epilepsy, generalized epilepsy, and focal epilepsy. After using the Bonferroni method for multiple testing correction, Class Betaproteobacteria [odds ratio (OR) = 1.357, 95% confidence interval (CI): 1.126-1.635, p = 0.001] and Order Burkholderiales (OR = 1.336, 95% CI: 1.112-1.606, p = 0.002). In addition, 21 nominally significant causal relationships were also identified. Further, the MR-Egger intercept test and MR-PRESSO global test suggested that our MR analysis was unaffected by horizontal pleiotropy (p > 0.05). Finally, the leave-one-out analysis suggested the robustness of the results. Through the MR study, we analyzed the causal relationship of 211 GM taxa with epilepsy and determined the specific intestinal flora associated with increased epilepsy risk. Our findings may provide helpful biomarkers for disease progression and potential candidate therapeutic targets for epilepsy. In addition, in-depth analysis of large-scale microbiome GWAS datasets based on metagenomics sequencing is necessary for future studies.