Chronic atrophic gastritis (CAG) serves as one of the warning signals for gastric cancer, and the utilization of traditional Chinese medicinal herbs brings hope for patients' recovery. In this study, a combination of bioinformatics and machine learning algorithms was employed to explore the precise targeting of CAG diagnostic biomarkers based on meta-analysis of key Chinese herbal formulas. Firstly, through integrating transcriptomic samples from normal gastric tissue and CAG tissue from three datasets (GSE116312, GSE27411, and GSE54129), differentially expressed genes (DEGs) were identified. Further functional and pathway analysis of the DEGs was performed using Gene Ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) analysis. Twelve Chinese herbal formulas were obtained through meta-analysis, and seven hub herbs were identified through association rule mining, namely, White Peony Root (Baishao), Largehead Atractylodes Rhizome (Baizhu), Pinellia Tuber (Banxia), Tangerine Peel (Chenpi), Root of Pilose Asiabell (Dangshen), Danshen Root (Danshen), and Coptis Root (Huanglian). A total of 248 target genes were associated with these medicinal herbs. Among the 905 CAG-related disease genes retrieved from five databases, 90 target genes of Chinese medicine (TCMTGs) were found to be shared with hub genes that are both pivotal and CAG-related. The regulatory network of Chinese medicine target genes and protein-protein interaction (PPI) network of target genes were constructed to observe the underlying mechanisms. Ten hub genes (BCL2L1, MAPK3, RASSF1, GSTP1, CCND1, CAT, MET, MMP3, THBD, and MAPK1) were identified from the intersection of DEGs and TCMTGs. Through gene correlation, sample expression levels, chromosomal positions, transcription factors, PPI networks, GO, and KEGG enrichment analysis, the characteristics of these hub genes were explored. By utilizing four machine learning algorithms – support vector machine (SVM), generalized linear model (GLM), decision tree model, and K-Nearest Neighbors model – diagnostic biomarkers for CAG (MET, MAPK1, and GSTP1) were obtained. The receiver operating characteristic (ROC) curves, nomogram plots, calibration curves, and clinical decision curves were constructed to evaluate the models. Finally, molecular docking was conducted between three protein receptors (MET-P08581, MAPK1-Q9H706, and GSTP1-P09211) and four active small molecular ligands of Chinese herbs (luteolin, naringenin, quercetin and kaempferol). In summary, the integration of machine learning models with bioinformatics methods for screening drug-targeting gene markers not only elucidated the mechanisms of active compounds in traditional Chinese medicine but also provided support for new drug development, thus increasing the potential to interrupt the progression of CAG into gastric cancer.