This paper proposes a stacking framework based on ensemble learning, aiming to establish a machine learning-based intrusion detection system to accurately differentiate various cyber-attack types that pose security risks to substations. The framework utilizes a combination of stacked base learners and secondary learners to generate binary feature matrices based on the probability weighting of natural or attack events and multi-class feature matrices of the probability of occurrence of all attack events. The model designed in this paper is trained using the power system attack detection dataset developed by the Oak Ridge National Laboratory at Mississippi State University. In the experimental results, the binary classification accuracy of the secondary learner reaches 97%, and the multiclass accuracy reaches 95%. This paper also discusses the importance of feature selection techniques for intrusion detection systems. Experimental results show that using RFE can maintain the model's accuracy at around 95% across different training/test set ratios of 9:1, 8:2, and 7:3.