Abstract Background Sepsis is a major global health concern, responsible for approximately 50 million cases and 11 million deaths annually, representing 20% of global mortality. It is the leading cause of hospital readmissions and deaths, with associated costs exceeding $38 billion per year. Alarmingly, 80% of sepsis cases occur outside the hospital, and 70% of patients visit an outpatient facility within a week of admission. Early diagnosis and appropriate treatment could prevent 80% of sepsis-related deaths. Our study demonstrates that machine learning models hold significant promise in identifying sepsis risks using routine blood tests up to 1 week before admission. Methods For our study, we utilized a dataset of over 25,000 patient records, including both sepsis and non-sepsis cases, sourced from MIMIC-IV (version 2.2), a comprehensive electronic health record dataset from Beth Israel Deaconess Medical Center, Boston, MA. We employed a gradient boosted model with 300 trees, a maximal depth of 30 layers, and gain ratio as the criterion for attribute selection. The model's performance was evaluated using 10-fold cross-validation, demonstrating optimal performance. Input parameters included age, gender, and results of routine blood markers such as complete blood counts, differential counts, comprehensive metabolic panels, and lipid panels recorded up to 1 week before sepsis diagnosis. Results Our model achieved remarkable predictive accuracy for sepsis risk, with an area under the receiver operating characteristic curve (AUC) of 0.99 and accuracy of 0.99. Notably, the model achieved 1.0 sensitivity, 0.99 specificity, 0.99 positive predictive value, 1.0 negative predictive value, 0.99 F measure, and 0.99 Youden index. Calcium, protein, liver enzymes, hematocrit, white blood cells, and cholesterol were identified as key contributors to sepsis risk prediction. Importantly, prediction accuracy remained consistent up to 1 week prior to diagnosis. Conclusions In conclusion, dysregulated intracellular calcium handling during sepsis is associated with an intensified inflammatory response, cellular death, and subsequent organ dysfunction. Low serum protein levels, particularly albumin, are linked to poor outcomes in sepsis. Recent studies have identified liver dysfunction as an early event in sepsis, underscoring its significance in the disease process. Elevated bilirubin levels are associated with an increased risk of mortality. Low hematocrit (HCT) levels are linked to higher 30-day mortality and serve as an independent prognostic biomarker in sepsis. Monocytes play a significant role in sepsis pathophysiology, undergoing various changes including preserved phagocytic activity, increased reactive oxygen species and nitric oxide generation, and decreased production of inflammatory cytokines such as IL-6 and TNF-alpha. Septic patients often exhibit lymphopenia, affecting CD4 and CD8 T cells, B cells, and natural killer (NK) cells. Hypocholesterolemia is common in sepsis and serves as an important early prognostic factor, with low plasma concentrations associated with poor outcomes. Since every hour of delayed treatment increases the risk of death by 4%-9%, changes in routine blood markers detected by machine learning models can provide early indications of impending sepsis up to 1 week before diagnosis.