In order to improve the accuracy of primary network dispatching operations and ensure the normal and stable operation of the power grid, this paper designs a two-stage dispatching operation error prevention method for the main network day-ahead and real-time according to optimized association rules. The method collects error information data of day-ahead and real-time scheduling operations and determines the correlation degree of the operation error information data using the optimization correlation rules. At the same time, the method determines the error risk level of the primary network scheduling operations, designs encrypted passwords and realizes the real-time execution of error prevention signals for scheduling operations. The simulation test results show that for 100 sets of random data, this paper's method's average error prevention execution time is 2.06s, which can process the data information in a short time and has real-time and high efficiency. The error-proof performance evaluation indexes (accuracy, recall and F1 value) of the method in this paper are 92.17%, 89.34% and 90.46%, respectively. The accuracy rate of all the execution results is higher than 80%, which is feasible and accurate and effectively improves the stability and safety of grid dispatch operation.