How to effectively apply MOOCs to the teaching of ideological and political theory courses in colleges and universities, improve the teaching quality of ideological and political theory courses and promote the realization of their teaching value, has undoubtedly become an important topic for scholars to study and discuss. In this paper, clustering algorithm is used to classify the learning behaviors of learners in ideological and political MOOCs, which are divided into four categories: "interactive learners", "active learners", "ordinary learners" and "marginal learners". It also analyzes the learning effects of these four types of learners and finds that: The "active learners" who perform better in all learning behaviors have the best learning effect, but there is little gap with "ordinary learners". "Interactive learners" do not achieve ideal results except for their outstanding performance in interaction. "Marginal learners" have the worst performance because of their insufficient investment in various learning behaviors.