With the increasing number of non-linear loads and impact loads in the actual power grid, power quality problems are becoming more and more serious. Accurate and rapid identification of power quality disturbance signals is of great significance for improving the power quality and ensuring stable operation of the power grid. For this reason, this paper proposes a multi-resolution analysis of wavelet transform and a combination of sample entropy to extract the characteristics of power quality disturbance signals. The classification effect is better than the initial samples. The weighted optimization random forest classifier is used to classify the features, which reduces the error caused by the mode voting method of the random forest. The simulation and actual test results show that the power quality disturbances detection algorithm based on sample entropy and weighted optimization random forest has better classification accuracy than the decision tree, extreme random tree and traditional random forest.