Background. Ankylosing spondylitis (AS) and inflammatory bowel disease (IBD) are prevalent autoimmune disorders that often co-occur, posing significant treatment challenges. This investigation adopts a multidisciplinary strategy, integrating bioinformatics, network pharmacology, molecular docking, and Mendelian randomization, to elucidate the relationship between AS and IBD and to investigate the potential mechanisms of traditional Chinese medicine formulations, represented by Qiangji Jianpi (QJJP) decoction, in treating these comorbid conditions. Methods. We utilized databases to pinpoint common targets among AS, IBD, and QJJP decoction’s active compounds through intersection analysis. Through Gene Ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) pathway analyses, we mapped a network in Cytoscape, isolating critical targets. Molecular docking with AutoDock validated the affinity between targets and compounds. ROC analysis and dataset validation assessed diagnostic performance, while Gene Set Enrichment Analysis (GSEA) offered pathway insights. Mendelian randomization explored the AS-IBD causal relationship. Results. Screening identified 105 targets for QJJP decoction, 414 for AS, and 2420 for IBD, with 85 overlapping. These targets predominantly participate in organismal responses and DNA transcription factor binding, with a significant cellular presence in the endoplasmic reticulum and vesicle lumen. Molecular docking, facilitated by Cytoscape, confirmed IL1A, IFNG, TGFB1, and EDN1 as critical targets, with IFNG demonstrating diagnostic potential through GEO dataset validation. The integration of GSEA with network pharmacology highlighted the therapeutic significance of the relaxin, osteoclast differentiation, HIF-1, and AGE-RAGE signaling pathways in QJJP decoction’s action. Mendelian randomization analysis indicated a positive causal relationship between IBD and AS, pinpointing rs2193041 as a key SNP influencing IFNG. Conclusion. Based on the principle of “treating different diseases with the same method” in traditional Chinese medicine theory, we explored the intricate mechanisms through which QJJP decoction addresses AS and IBD comorbidity. Our research spotlighted the pivotal role of the IFNG gene. IFNG emerges not only as a key therapeutic target but also assumes significance as a potential diagnostic biomarker through its genetic underpinnings. This investigation establishes a solid base for subsequent experimental inquiries. Our findings introduce novel approaches for incorporating traditional Chinese medicine into the treatment of AS-IBD comorbidity, setting the stage for groundbreaking research directions.