OBJECTIVES: The study aimed to investigate the causal relationships of gut microbiota (GM), ovarian cancer (OC), endometrial cancer (EC), and potential metabolite mediators using Mendelian randomization (MR) analysis. METHODS: Bidirectional two-sample MR analysis and reverse MR analysis of GM on OC/EC were employed to determine the causal effects of GM on OC/EC and the mediating role of blood metabolites in the relationship between GM and OC/EC, with results validated through sensitivity analysis. RESULTS: We identified 6 pathogenic bacterial taxa associated with OC, including Euryarchaeota, Escherichia-Shigella, FamilyXIIIAD3011group, Prevotella9, and two unknown genera. Christensenellaceae R.7group, Tyzzerella3, and Victivallaceae were found to be protective against OC. The increase in EC risk was positively associated with Erysipelotrichia, Erysipelotrichaceae, Erysipelotrichales, and FamilyXI. Dorea, RuminococcaceaeUCG014, and Turicibacter exhibited a negative correlation with the EC risk. A total of 26 and 19 blood metabolites related to GM were identified, showing significant correlations with OC and EC, respectively. Cytosine was found to be an intermediate metabolite greatly associated with EC and FamilyXI. In reverse MR analysis, the FamilyXIIIAD3011group exhibited a significant bidirectional causal relationship with OC. CONCLUSION: Our study revealed causal relationships of GM and intermediate metabolites with OC/EC, providing new avenues for understanding OC/EC and developing effective treatment strategies.