A study was conducted in Shahrekord city, Iran, focusing on improving the production of almond and walnut crops on rural agricultural lands. The gardeners selected for the study shared similar characteristics and production histories. One of the major challenges in producing these crops was the manual harvesting process, which required a significant amount of human labor in the region. To collect data, questionnaires and face-to-face interviews were conducted. The study used machine learning models, specifically artificial neural network (ANN) and adaptive neuro-fuzzy inference system (ANFIS) models, to predict energy use efficiency and environmental impacts in almond and walnut production. Among the models used, the ANFIS model with a three-level topology was found to be the most accurate in predicting output energy generation and environmental impacts in both almond and walnut production. The R2 values for the testing stage ranged from 0.969 to 0.996 for output energy generation and 0.994 to 0.997 for environmental impacts. The study demonstrated the effectiveness of using machine learning models like ANN and ANFIS in predicting energy use efficiency and environmental impacts in almond and walnut production, which can aid in planning and managing these crops more sustainably and efficiently in the future.