Gastric biopsy interpretation requires simultaneous assessment of malignancies, precancerous lesions, infections, and benign conditions, yet existing artificial intelligence models address only two to three diagnostic categories and have been evaluated under a single mode of clinical integration. Here we develop a deep learning model that classifies gastric biopsies into 29 pathological categories spanning malignancy subtypes, dysplasia, metaplasia, Helicobacter pylori , and benign findings. The model leverages a vision foundation model pre-trained on 70,618 whole slide images and fine-tuned end-to-end on 10,462 gastric biopsies without pixel-level annotations. On internal validation ( n = 2,957), the model achieves an area under the curve of 0.9945 for malignancy detection. We evaluate two paradigms for clinical integration: a post-read alert system and a concurrent assistance system. In retrospective simulation across four independent hospital cohorts ( n = 4,679), the post-read system identifies 17 malignancies that were missed or miscoded in routine diagnostic records. In a prospective reader study with six pathologists, concurrent AI assistance significantly improves sensitivity for malignancy (92.2% to 94.8%, P = .034) and metaplasia (94.2% to 97.4%, P = .013). Furthermore, the foundation model fine-tuned on only 400 slides outperforms a conventional model trained on over 10,000 slides, demonstrating extreme data efficiency. In addition, the model produces pixel-resolution lesion localization across all 29 categories without any pixel-level annotations, providing the heatmaps used in the concurrent assistance system. These results establish a framework for dual-mode AI deployment in gastric biopsy pathology—concurrent assistance for real-time diagnostic support and post-read alerts for retrospective quality assurance.