Random forests (RFs) are used in ecology to model complex, nonlinear relationships among environmental variables. However, many ecological datasets, particularly observational data collected across space, exhibit spatial dependence, which may mislead model interpretation by making spatially correlated predictors appear more important than they truly are (often referred to as spatial confounding). In this study, we compare the interpretability and predictive performance of RFs with and without accounting for spatial dependence. Using simulated data and an analysis of 1,061 North American river catchments, we show that accounting for spatial dependence can improve prediction accuracy and shifts model interpretation toward variables with more meaningful relationships to the response. Our findings demonstrate that formally accounting for spatial dependence, even in machine-learning models, is essential for both improving predictive accuracy and for ensuring meaningful ecological inference.