High-grade serous ovarian cancer (HGSOC) is a heterogeneous disease with diverse clinical outcomes, highlighting a need for prognostic biomarker identification. Here, we combined tumor microenvironment (TME) scores with HGSOC characteristics to identify immune-related prognostic genes through analysis of gene expression profiles and clinical patient data from The Cancer Genome Atlas and the International Cancer Genome Consortium public cohorts. We found that high TME scores (TMEscores) based on the fractions of immune cell types correlated with better overall survival. Furthermore, differential expression analysis revealed 329 differentially expressed genes between patients with high vs. low TMEscores. Gene Ontology and Kyoto Encyclopedia of Genes and Genomes analyses showed that these genes participated mainly in immune-related functions and, among them, 48 TME-related genes predicted overall survival in HGSOC. Seven of those genes were associated with prognosis in an independent HGSOC database. Finally, the two genes with the lowest -values in the prognostic analysis (GBP1, ETV7) were verified through experiments. These findings reveal specific TME-related genes that could serve as effective prognostic biomarkers for HGSOC.