The current study is aimed at developing a reliable flood susceptibility model by hyperparameter optimization and proposing a novel model to interpret the optimized machine learning model. Firstly, a total of 2064 flood areas and 20640 non-flood areas were identified at Ningxiang City to prepare the flood inventory map using satellite interpreted data. All the flood areas were randomly divided into two groups with 70% for training and 30% for validation purposes. Secondly, nineteen flood variables were generated for flood susceptibility modeling. Thirdly, VIF and Pearson correlation coefficient were used to ensure factor independence. Fourthly, five hyperparameter algorithms, including grid search (GS), random search (RS), gauss process (GP), Tree-structured Parzen Estimator (TPE) and simulate anneal (SA), were used to optimize random forest model (RF) for the purpose of modeling flood hazard. Finally, the area under curve (AUC-ROC) approach and confusion matrix were applied to evaluate the performances of the RF, RF-GS, RF-RS, RF-TPE, RF-GP, and RF-SA models. The SHAP model was adopted to interpret the previous models. The results indicated the following: (1) VIF is a good indicator for removing the effect of redundancy factors, which improves the accuracy of the model. (2) Distance from the river contributes most to flooding, followed by terrain relief, effective antecedent rainfall, peak rainfall intensity, TWI, continuous rainfall, lithology, Fc, etc. (3) Hyperparametric algorithms effectively improve the accuracy of the RF model, so RF, RF-GS, RF-RS, RF-TPE, RF-GP and RF-SA based on the AUC in the testing stage have values of 0.9418, 0.9458, 0.9476, 0.9633, 0.9606 and 0.9616 respectively. Our results show that hyperparameter optimization exhibited high performance, and the SHAP model provided a very reasonable explanation of the machine learning model. These two frameworks can also be applied to other machine learning models. Our findings may assist researchers and local governments in planning flood mitigation strategies.