Recently, several optimization strategies and models have been presented to analyze water-energy-food interconnections. In this study, a novel optimization model has been proposed to introduce the term water-energy-food-ecosystem nexus integrated with machine learning tools. This approach incorporates conventional and unconventional technologies for resource generation, use, and distribution, taking into account life cycle analysis, nexus security, and economic benefit as objectives toward sustainability. Additionally, it confirms the possibility of exploiting machine learning technologies to predict with high accuracy the results of complex MINLP models without requiring explicit indications as a support function for informed decision-making. The artificial neural network has been evaluated, optimized, and compared in a case study located in Mexico to show the applicability of the proposed approach. The nexus has been evaluated to determine the resilience of the system in the years 2020, 2022, 2025, 2030, and 2040. The results obtained when investigating the accuracy of the neural network model revealed a high prediction accuracy for the three objective functions, with values above 0.99 for the coefficient of determination and below 0.0007 for the mean square error. The 2020 compromise solution presents better trade-offs among the three objectives than the ones reported in the literature. Finally, by 2040, a significant increase in the environmental impact of 50% over the emissions generated in 2022 is found. While the security index indicates a severe scenario for water scarcity in the future.