Stroke is one of the major killer diseases in the world. Understanding the factors that influence the death of stroke patients is vital to improving patient care and outcomes. In this study, we used stroke patient data and machine learning techniques using a variety of algorithms, including Extreme Gradient Boosting, CatBoost, Extra Tree, Decision Tree, and Random Forest, to predict patient death after stroke. After performing hyperparameter settings, the XGBoost model achieved an accuracy of 86% with an AUC of 87. Significant improvements in the accuracy and predictive capability of this model after hyperparameter settings indicate a strong potential for clinical applications. In addition, our findings suggest that factors such as the patient's age, type of stroke, and blood pressure at the time of hospitalization have a significant impact on stroke patients' deaths. By understanding these factors, healthcare providers can improve patient intervention and management to reduce the risk of death after stroke. This research has made an important contribution to the development of a system for predicting the risk of death of stroke patients, which can help doctors and nurses identify high-risk patients and provide appropriate treatment.