Data is the primary source to scaffold physics teaching and learning for teachers and students, mainly reported through in-class assessment. Machine learning (ML) is an axis of artificial intelligence (AI) study that immensely attracts the development of physics education research (PER). ML is built to predict students’ learning that can support students’ success in an effective physics achievement. In this paper, two ML algorithms, logistic regression and random forest, were trained and compared to predict students’ achievement in high school physics (N = 197). Data on students’ achievement was harvested from in-class assessments administered by a physics teacher regarding knowledge (cognitive) and psychomotor during the 2020/2021 academic year. Three assessment points of knowledge and psychomotor were employed to predict students’ achievement on a dichotomous scale on the final term examination. Combining in-class assessment of knowledge and psychomotor, we could discover the plausible performance of students’ achievement prediction using the two algorithms. Knowledge assessment was a determinant in predicting high school physics students’ achievement. Findings reported by this paper recommended open room for the implementation of ML for educational practice and its potential contribution to supporting physics teaching and learning.