This paper mainly analyzed the application of inertial sensors in basketball posture analysis. The data of 20 basketball players in different postures were collected by MEMS inertial sensors. The mean, variance, and skewness were taken as features to compare the performance of C4.5, random forest (RF), k-nearest neighbor (KNN), and support vector machine (SVM) algorithms in analyzing posture data. It was found that the classification accuracy of the KNN algorithm was around 90%, and the classification accuracy of C4.5, RF, and SVM algorithms was all above 90%. The classification accuracy of the RF algorithm was the highest (98.72%), which was significantly higher than C4.5 and SVM algorithms. The results verified the advantages of the RF algorithm in basketball posture analysis. The research results confirm the reliability of the inertial sensor in the field of motion posture analysis and make some contributions to its application in sport training. This paper provides support for the analysis of motion posture.