Background Pituitary tumors are among the rare tumors of the central nervous system. With advances in screening, the incidence of pituitary tumors is increasing every year. The symptoms of pituitary tumors are similar to those of some common diseases, and it is common to miss the diagnosis, which can lead to serious complications, affect life expectancy and quality of life, and lead to poor prognosis due to side effects of adjuvant chemotherapy and radiotherapy. Therefore, the search for new biomarkers is important for the early diagnosis and treatment .Methods Datasets related to pituitary tumors from the GEO database were collected and integrated, firstly, DEG screening and GO, KEGG and GSEA enrichment analysis were performed, then LASSO and SVM-RFE algorithms were used to identify pituitary tumor-related signature genes in the training set, and ROC performance and gene expression differences were verified in the test set. Based on this, the immune infiltration differences were analyzed, and the correlation between signature genes and immune cells was studied.Results We finally screened 6 signature genes, including CNTNAP2, LHX3, RAB11FIP3, SOX9, TBX19 and TGFBR, whose expression showed differences, and the expression of signature genes was correlated with tumor infiltrating immune cells abundance gene expression.Conclusion In this study, 6 signature genes were screened to contribute to the development of immune-targeted therapeutic agents for the early diagnosis of pituitary tumor patients.