Spatial intelligence (SI) is the leverage that helps students to have a deeper understanding of concepts of science, technology, engineering and mathematics (STEM) and obtain outstanding academic achievement in STEM. The main objective of this research is to find effective factors in SI. Then, based on those factors, a machine learning (ML) model is developed for estimating students’ SI. To do that, data of 40 features such as demographic, behavioral, environmental and interest were collected from 396 high school students. Chi2, Boruta and Genetic algorithms were employed for identifying the most important features. Subsequently, 18 features were used to develop ML models. The ML models (Random Forest, Support Vector Machines, Multi-Layer Perceptron) achieved accuracy rates of 0.89, 0.84, and 0.78 on the test set. The stack model further increased accuracy to 0.92. The findings of this research have important implications in STEM. The model can estimate students' academic achievement in STEM by measuring their SI and using this for major selection, reducing the dropout rate, predicting student performance, and identifying and helping weaker students. Furthermore, by improving students' SI using the identified features, the quality of education can be enhanced, leading to more efficient and effective learning outcomes for students.