Background: Ovarian cancer (OC) has a high mortality rate and poses a severe threat to women’s health. However, abnormal gene expression underlying the tumorigenesis of OC has not been fully understood. This study aims to identify diagnostic characteristic genes involved in OC by bioinformatics and machine learning.Methods: We utilized five datasets retrieved from the Gene Expression Omnibus (GEO) database, The Cancer Genome Atlas (TCGA) database, and the Genotype-Tissue Expression (GTEx) Project database. GSE12470 and GSE18520 were combined as the training set, and GSE27651 was used as the validation set A. Also, we combined the TCGA database and GTEx database as validation set B. First, in the training set, differentially expressed genes (DEGs) between OC and non-ovarian cancer tissues (nOC) were identified. Next, Gene Ontology (GO), Kyoto Encyclopedia of Genes and Genomes (KEGG), Disease Ontology (DO) enrichment analysis, and Gene Set Enrichment Analysis (GSEA) were performed for functional enrichment analysis of these DEGs. Then, two machine learning algorithms, Least Absolute Shrinkage and Selector Operation (LASSO) and Support Vector Machine-Recursive Feature Elimination (SVM-RFE), were used to get the diagnostic genes. Subsequently, the obtained diagnostic-related DEGs were validated in the validation sets. Then, we used the computational approach (CIBERSORT) to analyze the association between immune cell infiltration and DEGs. Finally, we analyzed the prognostic role of several genes on the KM-plotter website and used the human protein atlas (HPA) online database to analyze the expression of these genes at the protein level.Results: 590 DEGs were identified, including 276 upregulated and 314 downregulated DEGs.The Enrichment analysis results indicated the DEGs were mainly involved in the nuclear division, cell cycle, and IL−17 signaling pathway. Besides, DEGs were also closely related to immune cell infiltration. Finally, we found that BUB1, FOLR1, and PSAT1 have prognostic roles and the protein-level expression of these six genes SFPR1, PSAT1, PDE8B, INAVA and TMEM139 in OC tissue and nOC tissue was consistent with our analysis.Conclusions: We screened nine diagnostic characteristic genes of OC, including SFRP1, PSAT1, BUB1B, FOLR1, ABCB1, PDE8B, INAVA, BUB1, TMEM139. Combining these genes may be useful for OC diagnosis and evaluating immune cell infiltration.