It is challenging to extract weak impulse features from vibration signals corrupted by strong noise in mechanical fault diagnosis. Due to its simple calculation, fast convergence and easy implementation, K-singular value decomposition (K-SVD) has been widely used in rolling bearing fault diagnosis. However, it fails to consider the influence of noise and harmonics on atoms learning from impulse characteristics, which results in many irrelevant atoms, and then increases the difficulty of extracting the impulse features in bearing fault signals. Therefore, a clustering K-SVD-based sparse representation method is proposed in this paper and it is combined with the particle swarm optimisation (PSO)-based time-varying filter empirical mode decomposition (TVF-EMD) for rolling bearing fault diagnosis. The PSO-based TVF-EMD is developed to automatically decompose the original signal to eliminate the impact of noise and harmonics on the impulses in the signal. Then, the clustering K-SVD method is applied to perform dictionary learning on the sensitive component containing impulses to obtain a redundant dictionary of atoms with obvious impulse patterns. Finally, the orthogonal matching pursuit (OMP) algorithm is introduced to extract the fault features from rolling bearing vibration signals. The experimental results show that the proposed method can improve the robustness of the dictionary atoms to noise and achieve the extraction of rolling bearing fault features.