Extensive research has been devoted to predicting ICU mortality, to assist clinical teams managing critical patients. Electronic health records (EHR) contain both static and dynamic medical data, with the latter accumulating during ICU stays. Existing models often rely on a fixed time window (e.g., first 24 h) for prediction, potentially missing vital post-24-hour data. The present study aims to improve mortality prediction for ICU patients following Cardiac Arrest (CA) using a dynamic sliding window approach that accommodates evolving data characteristics.Our cohort included 2331 CA patients, of whom 684 died in the ICU and 1647 survived. Applying the sliding window technique, we created six different time windows and used each separately for model training and validation. We compared our results to a baseline accumulative window.The different time windows created by the sliding window technique differed in their prediction performance and outperformed the baseline 24-hour window significantly. The XGBoost model outperformed all other models, with the 30–42 h time window achieving the best results (AUC = 0.8, accuracy = 0.77).Our work shows that the sliding window technique is effective in improving mortality prediction. We demonstrated how important time-window selection is and showed that enhancing it can save time and thus improve mortality prediction. These findings promise to improve the clinical team’s efficiency in prioritizing patients and giving greater attention to higher-risk patients.To conclude, mortality prediction in the ICU can be improved if we consider alternative time windows instead of the 24-hour window, which is currently the most widely accepted among scoring systems today.