Leprosy and psoriasis rarely coexist, the specific molecular mechanisms underlying their mutual exclusion have not been extensively investigated. This study aimed to reveal the underlying mechanism responsible for the mutual exclusion between psoriasis and leprosy. We obtained leprosy and psoriasis data from ArrayExpress and GEO database. Differential expression analysis was conducted separately on the leprosy and psoriasis using DEseq2. Differentially expressed genes (DEGs) with opposite expression patterns in psoriasis and leprosy were identified, which could potentially involve in their mutual exclusion. Enrichment analysis was performed on these candidate mutually exclusive genes, and a protein–protein interaction (PPI) network was constructed to identify hub genes. The expression of these hub genes was further validated in an external dataset to obtain the critical mutually exclusive genes. Additionally, immune cell infiltration in psoriasis and leprosy was analyzed using single-sample gene set enrichment analysis (ssGSEA), and the correlation between critical mutually exclusive genes and immune cells was also examined. Finally, the expression pattern of critical mutually exclusive genes was evaluated in a single-cell transcriptome dataset. We identified 1098 DEGs in the leprosy dataset and 3839 DEGs in the psoriasis dataset. 48 candidate mutually exclusive genes were identified by taking the intersection. Enrichment analysis revealed that these genes were involved in cholesterol metabolism pathways. Through PPI network analysis, we identified APOE, CYP27A1, FADS1, and SOAT1 as hub genes. APOE, CYP27A1, and SOAT1 were subsequently validated as critical mutually exclusive genes on both internal and external datasets. Analysis of immune cell infiltration indicated higher abundance of 16 immune cell types in psoriasis and leprosy compared to normal controls. The abundance of 6 immune cell types in psoriasis and leprosy positively correlated with the expression levels of APOE and CYP27A1. Single-cell data analysis demonstrated that critical mutually exclusive genes were predominantly expressed in Schwann cells and fibroblasts. This study identified APOE, CYP27A1, and SOAT1 as critical mutually exclusive genes. Cholesterol metabolism pathway illustrated the possible mechanism of the inverse association of psoriasis and leprosy. The findings of this study provide a basis for identifying mechanisms and therapeutic targets for psoriasis.