Objective: To investigate the role of CD2 gene on immune infiltration in ovarian cancer microenvironment. Methods: GEPIA online tool was used to retrieve the expression of CD2 gene in ovarian cancer, GEPIA and Kaplan-Meier plotter databases were used to analyze the value of CD2 gene in evaluating the prognosis of ovarian cancer. Co-expression gene network of CD2 gene in ovarian cancer was constructed by Coexpedia. The key genes were screened out according to the score, and the correlation between CD2 gene and key genes was further analyzed by GEPIA and cBioportal to speculate the expression of related genes in ovarian cancer and their value for prognosis assessment. TIMER was used to analyze the expression of CD2 and related genes in ovarian cancer and the relationship between CD2 and six kinds of immune cells in tumor microenvironment. Results: ①In TCGA, the expression of CD2 gene in tumor tissue of ovarian cancer was higher than that in normal ovarian tissue (P<0.05). ②Both GEPIA and Kaplan-Meier plotter suggested that patients with high expression of CD2 gene had longer overall survival (P<0.05). ③The co-expressed genes of CD2 gene are CD3D, LCK, ITK, CCL5, CD48, GZMK, PTPRC, TRAF31P3, SH2D1A, GZMA, CD247, CD52, IL10RA, CD3E, IKZF1, CD53, CD6, CXCR6 and CD3G. ④In order of the highest score, the top five key genes were screened out, namely CD3D, LCK, ITK, CCL5 and CD48. CD2 was positively correlated with the expression of CD3D, LCK, ITK, CCL5 and CD48 (P<0.05). ⑤TIMER analysis showed that CD2 gene was positively correlated with the infiltration of B cells, CD4+ T cells, CD8+ T cells, neutrophils, macrophages and dendritic cells in ovarian cancer (P<0.05). COX regression model suggested that the infiltration level of macrophages and neutrophils was positively correlated with the prognosis of patients, the infiltration level of CD4+ T cells was negatively correlated with the prognosis of patients(P<0.05). Conclusions: CD2 gene is highly expressed in ovarian cancer tissues, which may affect the prognosis of patients by affecting the infiltration of immune cells in tumor microenvironment.