This paper proposes a kernel function selection mechanism a support vector machine(SVM) under sparse representation and its application in bearing fault diagnosis. For a given data sample, a total of 125,150 different types of kernel functions and different parameters to classify and obtain the accuracy, root mean square error (RMSE) and mean square correlation coefficient (MSCC) of each training, these three values into an overcomplete redundant sparse dictionary. The OMP algorithm is used to solve the sparse coding, that are nonzero in the sparse coding are function types and parameters corresponding to these nonzero atoms according to the one-to-one correspondence between the sparse coding and the sparse dictionary. The nonzero atoms in the sparse coding and the kernel function types and parameters into the kernel function fitness table. According to the selection mechanism, we select the type of kernel function that is most suitable for the given data. A SVM is then composed of selected kernel function types, and PSO algorithm is used to the relevant parameters for classification of unknown data to Finally, we perform simulations and engineering experiments involving high-speed bearing fault diagnosis to verify the superiority of the selection mechanism.