Diabetes of the exocrine pancreas (DEP), also commonly described as pancreatogenic diabetes mellitus, is a type of diabetes secondary to abnormalities in pancreatic or exocrine secretion of the pancreas. However, its pathogenesis is not yet known. The aim of this article was to explore the biomarkers of DEP and their potential molecular mechanisms. Based on GSE76896 dataset, which was acquired from Gene Expression Omnibus (GEO), we identified 373 genes by weighted gene co-expression network analysis (WGCNA) and differential expression analysis. In addition, protein–protein interaction (PPI) network analysis and cytoHubba were used to screen potential hub genes. Five hub genes were determined, comprising Toll-like receptor 4 (TLR4), ITGAM, ITGB2, PTPRC, and CSF1R. Gene Ontology (GO) analysis and Kyoto Encyclopedia of Genes and Genomes (KEGG) pathways suggested macrophage activation and Toll-like receptor signaling pathway as important pathophysiological features of DEP. CIBERSORT suggested that TLR4 may regulate the immune pathway via macrophages. Next, we validated the expression and receiver operating characteristic curve (ROC) of the hub genes using the GSE164416 dataset. In addition, we used miRNet to predict the target miRNAs of hub genes and intersected them with common miRNAs in diabetes from the Human MicroRNA Disease Database (HMDD), which was used to propose a possible mechanistic model for DEP. The miRNA–mRNA network showed that has-miR-155-5p/has-miR-27a-3p/has-miR-21-5p-TLR4 might lead to TLR4 signaling pathway activation in DEP. In conclusion, we identified five hub genes, namely, TLR4, ITGAM, ITGB2, PTPRC, and CSF1R, as biomarkers to aid in the diagnosis of DEP and conducted an in-depth study of the pathogenesis of DEP at the genetic level.