Background: Although mortality remains high in patients with atrial fibrillation (AF), there have been limited studies exploring machine learning (ML) models on mortality risk prediction in patients with AF.Objectives: This study sought to develop an ML model that captures important variables in order to predict all-cause mortality in AF patients.Methods: In this single center prospective study, an ML-based mortality prediction model was developed and validated using a dataset of 2,012 patients who experienced AF from November 2018 to February 2020 at the First Affiliated Hospital of Shantou University Medical College. The dataset was randomly divided into a training set (70%, n = 1,223) and a validation set (30%, n = 552). A total of 122 features were collected for variable selection. Least absolute shrinkage and selection operator (LASSO) and random forest (RF) algorithms were used for variable selection. Ten ML models were developed using variables selected by LASSO or RF. The best model was selected and compared with conventional risk scores. A nomogram and user-friendly online tool were developed to facilitate the mortality predictions and management recommendations.Results: Thirteen features were selected by the LASSO regression algorithm. The LASSO-Cox model achieved an area under the curve (AUC) of 0.842 in the training dataset, and 0.854 in the validation dataset. A nomogram based on eight independent features was developed for the prediction of survival at 30, 180, and 365 days following discharge. Both the time dependent receiver operating characteristic (ROC) and decision curve analysis (DCA) showed better performances of the nomogram compared to the CHA2DS2-VASc and HAS-BLED models.Conclusions: The LASSO-Cox mortality predictive model shows potential benefits in death risk evaluation for AF patients over the 365-day period following discharge. This novel ML approach may also provide physicians with personalized management recommendations.