Monitoring groundwater pollution is an important issue in terms of analyzing threats to protected, environmentally valuable areas. The topographical and environmental characteristics of a given area are often mentioned among the factors affecting the dynamics and chemistry of groundwater. In this study, the random forest regression (RFR) model was used to determine the spatial distribution of selected metals, such as aluminum, calcium, iron, potassium, magnesium, manganese, sodium, and zinc. In the role of indicators describing terrain variability, derivatives of the digital elevation model (DEM) were employed, with a spatial resolution of 5 m, describing the topography of the terrain on a local scale, such as, among others, slopes, the aspect and curvatures of slopes, the topographic position index, and the SAGA wetness index, as well as generalized values determined for each sampling point of the areas contributing their runoff. In addition, environmental parameters were taken into consideration: forest habitat types, the structure of soil cover, and the seasons when samples were collected. This study used samples collected from 15 wells located in forested areas of the Wielkopolska National Park on seven dates. The results obtained show that random forest can be used with very good results to model the spatial variability of the concentrations of aluminum, potassium, magnesium, manganese, and sodium in groundwater. However, in the case of calcium and zinc, no correlations were found between the adopted indicators describing the spatial variability of the area and their concentrations in groundwater. In addition, the degree of importance of each predictor was determined in order to rank their importance in modeling the concentration of each of the metals in groundwater. The summary ranking of predictors indicates that the strongest influence on the predicted concentration of metals in groundwater is exhibited by profile curvatures, planar curvatures, multiscale TPI, and then the habitat type of the forest. On the other hand, curvature classifications, soil composition, and seasonality exhibit the smallest generalized impact on the results of modeling.