Semarang City is facing significant environmental challenges, with land subsidence being a critical issue that intensifies flood inundation and worsening flood damage. As urban areas expand and climate change impacts become more pronounced, understanding and mitigating flood risks are crucial for sustainable urban development and disaster management. Therefore, this study aimed to assess flood risk induced by land subsidence using machine learning to improve flood management. Five different machine learning models (MLMs) were used to assess flood risk, which included Decision Tree (DT), K-Nearest Neighbor (KNN), Logistic Regression (LR), Support Vector Machine (SVM), and Random Forest (RF). Additionally, fourteen different indices and 2884 sample points were used to train and test the models, with hyperparameter optimization ensuring fairness in comparisons. To address uncertainty in the sample dataset, flood hot spots were used to validate the rationality of flood risk zoning maps. The study investigated driving factors of different flood risk levels, focusing on flood areas to determine flood risk mechanisms in the highest-risk areas. The results showed that KNN performed the best and provided the most reasonable flood risk value among the models. Meanwhile, curve number (CN), distance to the river (DTRiver), and Building Density (BD) were identified as the top three significant factors of flood risk, ranked using the average score decrease in KNN model. Finally, this study expanded the application of machine learning for flood risk assessment and also deepened understanding of the potential mechanisms of flood risk, and provided perceptions about better flood risk management.