This paper addresses the significant issue of embodied carbon in buildings and presents a comprehensive approach to its assessment. A machine learning model is proposed, leveraging authentic databases and supervised learning techniques to estimate the environmental impacts of embodied carbon throughout the building life cycle. Validation of the model revealed average percentage errors of approximately 15.71% across different countries. The study also introduces a standardized algorithmic protocol and guidelines for assessing embodied carbon, demonstrated through a case study in Morocco. Results indicate that conventional residential buildings of 120 m2 emit 34.7 tons of embodied carbon, with floors contributing 55%, structure 27%, envelope 14%, and openings 4%. Notably, insulation accounts for 37.0% of the total embodied carbon. Recommendations include incorporating additional databases for learning, considering transportation emissions and primary materials sources, and training the model for different life cycle stages to enhance accuracy. This research provides valuable insights for reducing embodied carbon in buildings and promoting sustainable construction practices.