Using machine learning, we screened RAD51D and XRCC2 in the homologous recombination pathway as diagnostic biomarkers for gastric cancer. Here, XRCC2 is linked to gastric cancer.