The article discusses a study on smart farming that uses the Internet of Things (IoT) and machine learning (ML) algorithms for predicting agricultural conditions in Indonesia. Various algorithms, including Extreme Gradient Boosting (XGBoost), Random Forest (RF), Decision Trees (DT), and Linear Regression, were analyzed, with XGBoost yielding the best results for temperature and soil moisture predictions. The research emphasizes the integration of IoT and AI to enhance agricultural productivity and offers insights into the challenges faced by rural farmers in adopting these technologies.