Surgical site infections (SSIs) are the commonest healthcare-associated infection. In addition to increasing mortality, it also lengthens the hospital stay and raises healthcare expenses. SSIs are challenging to predict, with most models having poor predictability. Therefore, we developed a prediction model for SSI after elective abdominal surgery by identifying risk factors. To analyse the data on inpatients undergoing elective abdominal surgery to identify risk factors and develop predictive models that will help clinicians assess patients preoperatively. We retrospectively analysed the inpatient records of Shaanxi Provincial People's Hospital from January 1, 2018 to January 1, 2021. We included the demographic data of the patients and their haematological test results in our analysis. The attending physicians provided the Nutritional Risk Screening 2002 (NRS 2002) scores. The surgeons and anaesthesiologists manually calculated the National Nosocomial Infections Surveillance (NNIS) scores. Inpatient SSI risk factors were evaluated using univariate analysis and multivariate logistic regression. Nomograms were used in the predictive models. The receiver operating characteristic and area under the curve values were used to measure the specificity and accuracy of the model. A total of 3018 patients met the inclusion criteria. The surgical sites included the uterus (42.2%), the liver (27.6%), the gastrointestinal tract (19.1%), the appendix (5.9%), the kidney (3.7%), and the groin area (1.4%). SSI occurred in 5% of the patients (n = 150). The risk factors associated with SSI were as follows: Age; gender; marital status; place of residence; history of diabetes; surgical season; surgical site; NRS 2002 score; preoperative white blood cell, procalcitonin (PCT), albumin, and low-density lipoprotein cholesterol (LDL) levels; preoperative antibiotic use; anaesthesia method; incision grade; NNIS score; intraoperative blood loss; intraoperative drainage tube placement; surgical operation items. Multivariate logistic regression revealed the following independent risk factors: A history of diabetes [odds ratio (OR) = 5.698, 95% confidence interval (CI): 3.305-9.825, P = 0.001], antibiotic use (OR = 14.977, 95%CI: 2.865-78.299, P = 0.001), an NRS 2002 score of ≥ 3 (OR = 2.426, 95%CI: 1.199-4.909, P = 0.014), general anaesthesia (OR = 3.334, 95%CI: 1.134-9.806, P = 0.029), an NNIS score of ≥ 2 (OR = 2.362, 95%CI: 1.019-5.476, P = 0.045), PCT ≥ 0.05 μg/L (OR = 1.687, 95%CI: 1.056-2.695, P = 0.029), LDL < 3.37 mmol/L (OR = 1.719, 95%CI: 1.039-2.842, P = 0.035), intraoperative blood loss ≥ 200 mL (OR = 29.026, 95%CI: 13.751-61.266, P < 0.001), surgical season (P < 0.05), surgical site (P < 0.05), and incision grade I or III (P < 0.05). The overall area under the receiver operating characteristic curve of the predictive model was 0.926, which is significantly higher than the NNIS score (0.662). The patient's condition and haematological test indicators form the bases of our prediction model. It is a novel, efficient, and highly accurate predictive model for preventing postoperative SSI, thereby improving the prognosis in patients undergoing abdominal surgery.