Stunting is a problem in toddlers when their height is too low compared to other toddlers their age. Prevention of stunting in toddlers is necessary to avoid long-term effects on toddlers. One way that can be done to reduce stunting rates in Indonesia is to create a system using machine learning that can predict stunting conditions in children to prevent and minimize the occurrence of stunting in children. This research analyzes two machine learning models that are potentially suitable for predicting stunting, namely Random Forest and XGBoost. In this research, the dataset has an imbalance issue. The stunting case is only 3.9% of the total dataset. To overcome this problem, we must perform an oversampling process in the minority class (Stunting). Oversampling is done by generating random data based on the distribution of data classified as minority. The minority class (stunting) data is generated using a quartile-based random sampling method. The research results show that Random Forest and XGBoost demonstrated good predictive capabilities. Random Forest achieved an accuracy of 98.32% and an F1-Score Average of 88.52%, while XGBoost slightly outperformed with an accuracy of 98.42% and an F1-Score Average of 89.06%. The results show that XGBoost has better performance due to its boosting mechanism, but Random Forest remains the right choice when interpretability and simplicity in implementation are prioritized.