Using advanced bioinformatics techniques, we conducted an analysis of ferroptosis-related genes (FRGs) in precancerous lesions of gastric cancer (PLGC). We also investigated their connection to immune cell infiltration and diagnostic value, ultimately identifying new molecular targets that could be used for PLGC patient treatment. The Gene Expression Omnibus (GEO) and FerrDb V2 databases were used to identify FRGs. These genes were analysed via ClueGO pathways and Gene Ontology (GO) enrichment analysis, as well as single-cell dataset GSE134520 analysis. A machine learning model was applied to identify hub genes associated with ferroptosis in PLGC patients. Receiver Operating Characteristics (ROC) curve analysis was conducted to verify the diagnostic efficacy of these genes, and a PLGC diagnosis model nomogram was established based on hub genes. R software was utilized to conduct functional, pathway, gene set enrichment analysis (GSEA) and gene set variation analysis (GSVA) on the identified diagnostic genes. Hub gene expression levels and survival times in gastric cancer were analysed using online databases to determine the prognostic value of these genes. MCPcounter and single-sample gene set enrichment analysis (ssGSEA) algorithms were used to investigate the correlation between hub genes and immune cells. Finally, noncoding RNA regulatory mechanisms and transcription factor regulatory networks for hub genes were mapped using multiple databases. Eventually, we identified 23 ferroptosis-related genes in PLGC. Enrichment analyses showed that ferroptosis-related genes were closely associated with iron uptake and transport and ferroptosis in the development of PLGC. After differential analysis using machine learning algorithms, we identified four hub genes in PLGC patients, including MYB, CYB5R1, LIFR and DPP4. Consequently, we established a ferroptosis diagnosis model nomogram. GSVA and GSEA mutual verification analysis helped uncover potential regulatory mechanisms of hub genes. MCPcounter and ssGSEA analysed immune infiltration in the disease and indicated that B cells and parainflammation played an important role in disease progression. Finally, we constructed noncoding RNA regulatory networks and transcription factor regulatory networks. Our study identified ferroptosis-related diagnostic genes and therapeutic targets for PLGC, providing novel insights and a theoretical foundation for research into the molecular mechanisms, clinical diagnosis, and treatment of this disease.