The online collaborative learning platform for physical education is an interactive and open physical education teaching mode. To improve students’ learning interest and efficiency, the online sports collaborative learning platform is designed. From the perspective of person-post matching, the role in the group is designed and the improved clustering algorithm is used to realize the grouping. The combination of the k-mean algorithm and the firefly algorithm is used to enhance the real-time and accuracy of learning resource recommendation. The outcomes demonstrated that the Firefly algorithm had obvious advantages in convergence speed and other aspects. Relative to the classical K-means algorithm and the Firefly algorithm, the average clustering accuracy of the presented algorithm was improved by 7.23 % as well as 2.18 %, and the average processing time was improved by 4.35 % and 2.26 %, respectively. In the dataset Iris, the average clustering accuracy and processing time were 91.29 and 8.65, respectively. The optimal, worst, and average values of the online collaborative learning platform on the ground of the firefly-optimized K-means algorithm were 0.3006, 3.2176, and 1.5234, respectively. The fusion algorithm proposed in this study can optimize the recommendation of teaching resources on sports online collaborative learning platforms, improve learners’ learning passion, learning efficiency, and satisfaction, and relieve teachers’ teaching pressure.