The AUCs of CD8+ T cells and CD163+ macrophages were 0.727 and 0.833, respectively, which indicated that CD8 and CD163 were potential diagnostic markers for endometriosis. The gene discussed is CD8A; the disease is endometriosis.