Differentiating the magmatism in different tectonic environments is the basic means to understand the magma formation process in the mantle. At present, it is more mature to use whole rocks to distinguish and discriminate. While, the use of rock-forming minerals to discriminate the tectonic environment and deduce magmatic evolution is still insufficient. In this paper, we use the geochemical data of clinopyroxene in the mafic-ultramafic magmatite,which is in oceanic mid-ocean ridge, oceanic island, and island-arc tectonic setting in the global Cenozoic as research object, trying to distinguish the three kinds of clinopyroxene in different tectonic environments with machine learning methods. By the calculation and comparison of K-Nearest Neighbor（KNN）and Random Forest（RF）in the machine learning method, it is considered that RF is an effective geochemical discrimination method, and its results can be used not only to discriminate tectonic environment, but also to extract characteristic elements. At the same time, we found that the trace elements such as Rb, La, Ba, Cr, Sr, Yb, V, Ti, Nd, Eu, Gd have a higher contribution rate in the discrimination of clinopyroxene from mafic-ultramafic magmatite, and the contribution rate of the major elements is low. Based on this, we propose several discriminative diagrams with better discriminant effect combining with previous research results. However, the lack of visualization results in the whole research limits the popularization of machine learning method. This is also a subject that we need to study further in the future.