Background: Tumor-infiltrating T cells in the tumor microenvironment are the biological basis of immunotherapy and promising predictors of cancer prognosis. Aim: The aim of this study was to investigate immune‐related RNAs associated with tumor-infiltrating T cells in ovarian cancer (OV).Methods: The gene expression data of patients with OV were downloaded from The Cancer Genome Atlas (TCGA) database. The immune and stromal scores were calculated and the differentially expressed mRNAs (DEGs) were screened. The abundance of six types of infiltrating immune cells was investigated, and the immune-related DEGs associated with tumor-infiltrating CD4+ and CD8+ T cells were explored by correlation analyses. Subsequently, multiple analyses, i.e., protein-protein interaction (PPI) network analysis, competing endogenous RNA (ceRNA; lncRNA-miRNA-target) network analysis, and small-molecule target network analysis, were performed. Results: In total, 37 and 49 immune-related DEGs of CD4+ and CD8+ T cells were screened, respectively. PPI network results showed that granzyme B (GZMB) was a hub node in the two PPI networks constructed by immune-related DEGs of CD4+ and CD8+ T cells. Moreover, the ceRNA chr22-38_28785274-29006793.1/has-miR-1249-5p/CD3E was obtained from the two constructed ceRNA networks related to CD4+ and CD8+ T cells. Survival analysis revealed that key immune-related DEGs of CD4+ and CD8+ T cells, such as GZMB and CD3E, were positively correlated with patient prognosis. Conclusion: GZMB and ceRNAs, such as chr22-38_28785274-29006793.1/has-miR-1249-5p/CD3E, may mediate the role of tumor-infiltrating T cells in OV. GZMB and CD3E may be used as promising T cell-related biomarkers with prognostic value in OV.