Increasing mining depths often positions the mine pit below the groundwater level, leading to higher costs, reduced efficiency, and compromised work safety. Traditional methods for identifying groundwater flow direction in complex mining areas have limitations in accuracy and applicability. This study addresses this gap using advanced supervised machine learning techniques to model groundwater levels and determine the flow direction. Six machine-learning models were evaluated: group method of data handling, multilayer perceptron optimized with batch training, cascade forward optimized with gradient descent and adaptive learning, random subspace ensemble, multivariate adaptive regression splines, and extreme learning machines. A total of 2808 cleaned and preprocessed data points were used, consisting of 12 spatial input features and 10 temporal input features collected from six piezometers around the Gohar Zamin iron ore mine. The performance of models was enhanced by applying feature selection to identify the most influential inputs and data cleaning to remove outliers. The random subspace (RS) model outperformed all others, achieving an R2 of 0.997, an RMSE of 2.65 m, and an AAPRE of 0.07%. This model was used to predict groundwater levels at seven unmeasured locations. Analysis of observed and predicted data revealed that groundwater flow is directed toward the center and west of the pit. Detailed error analysis indicated that piezometer no. 1 had the lowest average error, while piezometer no. 5 exhibited the highest, highlighting spatial variability in model accuracy. This research provides a more accurate method for predicting groundwater flow direction and offers a novel application of machine learning in complex mining scenarios.