A machine-learning-based model is proposed for the wall heat flux in the flame–wall interaction (FWI). The model is trained by the neural network (NN), and the direct numerical simulation (DNS) database of FWI of head-on quenching and side-wall quenching are employed as the training data, considering the premixed methane–air combustion in a one-dimensional and two-dimensional constant volume vessel. In this NN model, the time-averaged wall heat flux, as the output quantity, is considered as a function of FWI characteristics, including combustion equivalence ratio, pressure, preheat temperature of unburned mixture, and wall temperature. The performance of the model is evaluated with analysis. Results indicate that the NN model trained solely with one-dimensional DNS results demonstrates satisfactory performance in predicting wall heat flux in head-on quenching scenarios under various thermochemical conditions, achieving a Pearson’s correlation coefficient of 0.95 or higher. For the prediction of wall heat flux in a two-dimensional turbulent combustion scenario, the NN model trained with both one-dimensional and two-dimensional DNS results also produces a correlation coefficient over 0.9. The prediction accuracy slightly decreases in turbulent combustion conditions, which is probably due to the limited incorporation of near-wall flame-turbulence interaction effect in the model training. The current study serves as an initial exploration of wall heat flux modeling by incorporating FWI characteristics as significant factors. Also, it underlines the FWI dynamics and wall heat transfer within wall-bounded combustion.