Acute pancreatitis (AP) stands out as a primary cause of hospitalization within gastrointestinal ailments, attributed to diverse factors, including Epstein-Barr virus (EBV) infection. Nevertheless, the common miRNAs and genes shared between AP and EBV infection remain unclear. In the present study, four datasets GSE194331, GSE42455, GSE45918 and GSE109220 were selected and downloaded from the Gene Expression Omnibus (GEO) database. Differential expression analysis was performed to screen for differentially expressed genes (DEGs) and differentially expressed miRNAs (DEMs). Target genes of overlapping DEMs were predicted, and intersections with overlapping DEGs were used to construct a miRNA-mRNA network. In addition, the enrichment analysis, drug prediction, diagnostic accuracy assessment, competitive endogenous RNA (ceRNA) network construction, transcription factor (TF)-miRNA-mRNA network construction, and immune cell infiltration analysis were also carried out. We found a total of 111 genes and 8 miRNAs shared between AP and EBV infection. A miRNA-mRNA network was constructed, which comprised 5 miRNAs and 10 genes exhibiting robust diagnostic performance. Histone deacetylase (HDAC) inhibitor was identified as a novel therapeutic intervention from drug prediction analysis. The results of immune cell infiltration analysis revealed that a consistent and significant difference could be found on activated B cell in AP and EBV-infected individuals in comparison to the controls. Taken together, our work, for the first time, revealed a miRNA-mRNA network shared between AP and EBV infection, thereby enriching a deeper comprehension of the intricate molecular mechanisms and potential therapeutic targets entwined in these two pathological conditions.