Objective: Observational studies have established a connection between gut microbiota and ankylosing spondylitis (AS) risk; however, whether the observed associations are causal remains unclear. Therefore, we conducted a two-sample Mendelian randomization (MR) analysis to assess the potential causal associations of gut microbiota with AS risk., Methods: Instrumental variants of gut microbiota were obtained from the MiBioGen consortium (n = 18,340) and the Dutch Microbiome Project (n = 7738). The FinnGen consortium provided genetic association summary statistics for AS, encompassing 2860 cases and 270,964 controls. We used the inverse-variance weighted (IVW) method as the primary analysis, supplemented with the weighted median method, maximum likelihood-based method, MR pleiotropy residual sum and outlier test, and MR-Egger regression. In addition, we conducted a reverse MR analysis to assess the likelihood of reverse causality., Results: After the Bonferroni correction, species Bacteroides vulgatus remained statistically significantly associated with AS risk (odds ratio (OR) 1.55, 95% confidence interval (CI) 1.22-1.95, P = 2.55 × 10 -4 ). Suggestive evidence of associations of eleven bacterial traits with AS risk was also observed (P < 0.05 by IVW). Among them, eight were associated with an elevated AS risk (OR 1.37, 95% CI 1.07-1.74, P = 0.011 for phylum Verrucomicrobia; OR 1.31, 95% CI 1.03-1.65, P = 0.026 for class Verrucomicrobiae; OR 1.17, 95% CI 1.01-1.36, P = 0.035 for order Bacillales; OR 1.31, 95% CI 1.03-1.65, P = 0.026 for order Verrucomicrobiales; OR 1.43, 95% CI 1.13-1.82, P = 0.003 for family Alcaligenaceae; OR 1.31, 95% CI 1.03-1.65, P = 0.026 for family Verrucomicrobiaceae; OR 1.31, 95% CI 1.03-1.65, P = 0.026 for genus Akkermansia; OR 1.55, 95% CI 1.19-2.02, P = 0.001 for species Sutterella wadsworthensis). Three traits exhibited a negative association with AS risk (OR 0.68, 95% CI 0.53-0.88, P = 0.003 for genus Dialister; OR 0.84, 95% CI 0.72-0.97, P = 0.020 for genus Howardella; OR 0.75, 95% CI 0.59-0.97, P = 0.026 for genus Oscillospira). Consistent associations were observed when employing alternate MR methods. In the reverse MR, no statistically significant correlations were detected between AS and these bacterial traits., Conclusion: Our results revealed the associations of several gut bacterial traits with AS risk, suggesting a potential causal role of gut microbiota in AS development. Nevertheless, additional research is required to clarify the mechanisms by which these bacteria influence AS risk. Key Points • The association of gut microbiota with AS risk in observational studies is unclear. • This MR analysis revealed associations of 12 gut bacterial traits with AS risk., (© 2024. The Author(s), under exclusive licence to International League of Associations for Rheumatology (ILAR).)