It has been recognized that oxidative stress (OS) is implicated in the etiology of recurrent pregnancy loss (RPL), yet the biomarkers reflecting oxidative stress in association with RPL remain scarce. The dataset GSE165004 was retrieved from the Gene Expression Omnibus (GEO) database. From the GeneCards database, a compendium of 789 genes related to oxidative stress-related genes (OSRGs) was compiled. By intersecting differentially expressed genes (DEGs) in normal and RPL samples with OSRGs, differentially expressed OSRGs (DE-OSRGs) were identified. In addition, four machine learning algorithms were employed for the selection of diagnostic markers for RPL. The Receiver Operating Characteristic (ROC) curves for these genes were generated and a predictive nomogram for the diagnostic markers was established. The functions and pathways associated with the diagnostic markers were elucidated, and the correlations between immune cells and diagnostic markers were examined. Potential therapeutics targeting the diagnostic markers were proposed based on data from the Comparative Toxicogenomics Database and ClinicalTrials.gov. The candidate biomarker genes from the four models were further validated in RPL tissue samples using RT-PCR and immunohistochemistry. A set of 20 DE-OSRGs was identified, with 4 genes (KRAS, C2orf69, CYP17A1, and UCP3) being recognized by machine learning algorithms as diagnostic markers exhibiting robust diagnostic capabilities. The nomogram constructed demonstrated favorable predictive accuracy. Pathways including ribosome, peroxisome, Parkinson's disease, oxidative phosphorylation, Huntington's disease, and Alzheimer's disease were co-enriched by KRAS, C2orf69, and CYP17A1. Cell chemotaxis terms were commonly enriched by all four diagnostic markers. Significant differences in the abundance of five cell types, namely eosinophils, monocytes, natural killer cells, regulatory T cells, and T follicular helper cells, were observed between normal and RPL samples. A total of 180 drugs were predicted to target the diagnostic markers, including C544151, D014635, and CYP17A1. In the validation cohort of RPL patients, the LASSO model demonstrated superiority over other models. The expression levels of KRAS, C2orf69, and CYP17A1 were significantly reduced in RPL, while UCP3 levels were elevated, indicating their suitability as molecular markers for RPL. Four oxidative stress-related diagnostic markers (KRAS, C2orf69, CYP17A1, and UCP3) have been proposed to diagnose and potentially treat RPL.