<span>Smart farming is a type of technology that utilizes the internet of things (IoT) to provide information on agricultural and environmental conditions as well as perform automation. Some of these ecological conditions can be used and analyzed in machine learning (ML) data management. This study focuses on utilizing ML algorithms to find the best prediction; typically used methods include linear regression, decision tree (DT), random forest (RF), and extreme gradient boosting (XGBoost). In the application of smart farming, research on IoT and artificial intelligence (AI) is still uncommon since most IoT cannot make predictions like AI. Because basically, some IoT can't make predictions as AI does. In this Study, predictions were made by looking at the regression results in the form of root mean square error (RMSE) and absolute error. The results show a strong and weak correlation between features (positive or negative). The best prediction results are obtained by XGBoost when predicting temperature (RMSE 6.656 and absolute error 3.948) and (soil moisture 17.151 and absolute error 11.269). However, using different parameters (RMSE RF and absolute error DT) on RF and DT resulted in good and distinct results. Linear regression, on the other hand, produced unsatisfactory and poor result.</span>