Helicobacter pylori (H. pylori) infection is considered to be a primary causative factor for gastric cancer and a common cause of chronic gastritis worldwide. Identifying H. pylori infection through hematoxylin and eosin (H&E) staining is demanding and tedious for pathologists. We aimed to use artificial intelligence (AI) models to improve the accuracy and efficiency of H. pylori diagnosis and to reduce the workload of pathologists. Here, we developed three multi-instance learning (MIL) models: AB-MIL, DS-MIL, and Trans-MIL, to automatically detect H. pylori infection. A total of 1,020 digitized histological whole-slide images (WSI) from 817 patients were used for training, validating and testing sets at a ratio of 3:1:1. Additionally, 100 cases (218 WSIs) were randomly selected from the test set for pathologists to identify H. pylori under the microscope. The accuracy, specificity, sensitivity, false negative rate, false positive rate, and other metrics were calculated separately for the MIL models and the pathologists. All three models demonstrated good diagnostic performance in predicting H. pylori infection, with the DS-MIL classification model showing the best diagnostic performance, achieving an accuracy of 89.7% and an area under the curve (AUC) of 0.949, which is higher than the accuracy rate of senior pathologists at 81.7%. Furthermore, the model demonstrates superior performance in terms of sensitivity and specificity. The reliability of DS-MIL is confirmed through the Visual model. Our research presents an AI - based predictive model for H. pylori infection, which significantly enhances clinical efficiency and diagnostic accuracy. Currently, we are conducting multi-center validation to enhance the model's generalization capability.