Prolyl endopeptidases from Sphingomonas capsulata (SC PEP) has attracted much attention as promising oral therapy candidate for celiac sprue, however, its low stability in the gastric environment leads to unsatisfactory clinical results. Therefore, improving its stability against pepsin digestion at low pH is crucial for clinical applications, but challenging. In this study, machine learning and physical parameter model were combined to design SC PEP mutants. After iterations, 20 mutants had higher hydrolysis activity in stomach environment, which was up to 14.1-fold compared with wild-type SC PEP. Mutant M24 involving stable and active mutations and pegylated M24 (M24-PEG) had higher activity of hydrolyzing immunogen in bread than wild-type SC PEP in vitro and in vivo, and residual immunogens in simulated gastric environment were only 1/8 and 1/10 of that in the wild-type SC PEP group. The total residual immunogens in the gastrointestinal tract of mice in the M24 and M24-PEG groups were <20 ppm, reaching the standard of non-toxic food. Our results indicate that the combination of M24 (or M24-PEG) with EP-B2 may be a promising candidate for celiac disease, and the strategies developed in this study provide a paradigm for the design of SC PEP stability mutants.