In order to improve the accuracy of transformer fault diagnosis, this paper proposes a transformer fault diagnosis method based on kernel principal component analysis (KPCA) and wolf pack algorithm (WPA) to optimize the support vector machine (SVM) parameters. KPCA extracts the non-linear characteristics of the sample data and obtains its principal components, and then inputs them into the Gaussian kernel SVM to form a diagnostic model, and then uses the wolf pack algorithm (WPA) to optimize the penalty factor and kernel parameters of the SVM. Experimental results show that the diagnostic accuracy rate of this method reaches 93.33%, which is higher than the traditional support vector machine and KPCA-SVM diagnostic model.