Background: Inflammatory bowel disease (IBD) is a persistent, non-specific inflammation affecting the intestines. Psoriasis is a long-lasting inflammatory disorder of the skin. There is a comorbidity correlation between IBD and psoriasis, but the specific pathogenesis of the comorbidity is unclear. Materials and methods: In this study, we analyzed datasets sourced from the Gene Expression Omnibus (GEO) database, and identified shared genes of IBD and psoriasis through differential expression analysis and weighted gene co-expression network analysis (WGCNA). Then three machine learning algorithms were applied to identify shared diagnostic genes. Next, the validation of shared diagnostic genes was evaluated with ROC curves, with the AUC determined. Subsequently, single sample gene set enrichment analysis (ssGSEA) and immune infiltration analysis were conducted. Furthermore, we obtained potential drugs such as securinine in the Drug Signature Database (DsigDB) and 7 traditional Chinese medicines in the Coremine database, which might have therapeutic effects on the comorbidity of IBD and psoriasis. Finally, we confirmed the expression of the shared diagnostic gene in colitis and psoriasis mice tissues through RT-PCR, Western blot and immunohistochemistry (IHC) methods. Results: The results showed that AQP9 had the highest diagnostic value for two diseases. AQP9 had AUC values of 93.681% for UC, 89.629% for CD,and 78.689% for psoriasis in the internal validation datasets. In the external validation datasets, AQP9 had AUC values of 90.394% for UC, 93.909% for CD,and 82.906% for psoriasis. Immune infiltration analysis and ssGSEA revealed that AQP9 might impact the disease process of IBD and psoriasis by participating in the NF-kappaB signaling pathway, and modulating immune cell differentiation. Furthermore, the expression levels of AQP9 were consistently validated, showing upregulation in IBD and downregulation in psoriasis, compared to the control group. Conclusions: This study revealed the shared diagnostic genes and potential mechanisms of the comorbidity of IBD and psoriasis, providing new directions for future research on exploring the comorbidity mechanisms and treatment targets.