Methazolamide is a carbonic anhydrase (CA) inhibitor with satisfactory safety. Our previous studies have demonstrated the elevation of CA1 expression and the therapeutic effect of Methazolamide in Ankylosing spondylitis (AS). In this study, we explored the pathogenic role of CA1 and the pharmacological mechanism of Methazolamide in AS through Gene Set Enrichment Analysis (GSEA) and network pharmacology. Seven out of twelve CA1 related gene sets were enriched in AS group. CA1 was core enriched in above seven gene sets involving zinc ion binding, arylesterase activity and one carbon metabolic process. Functional analysis of the candidate target genes obtained from the intersection of AS associated genes and Methazolamide target genes indicated that Methazolamide exerts therapeutic effects on AS mainly through inflammatory pathways which regulate the production of tumor necrosis factor, IL-6 and nitric oxide. PTGS2, ESR1, GSK3β, JAK2, NOS2 and CA1 were selected as therapeutic targets of Methazolamide in AS. Molecular docking and molecular dynamics simulations were performed successfully. In addition, we innovatively obtained the intersection of Gene Ontology (GO)/Kyoto Encyclopedia of Genes and Genomes (KEGG) analyses and GSEA results, and found that 18 GO terms and 5 KEGG terms were indicated in the pharmacological mechanism of Methazolamide in AS, involving bone mineralization, angiogenesis, inflammation, and chemokine signaling pathways. Nevertheless, validation for these mechanisms is needed in vivo/vitro experiments.