In this study, we identified two key genes associated with both AP and T2DM (SLPI and ARHGEF9) using several machine learning algorithms and developed a 2-gene diagnostic model. This evidence concerns the gene SLPI and type 2 diabetes mellitus.