With the accelerated digital transformation of power systems, traditional protection measures can no longer cope with complex attack methods. In this paper, for the problem of data privacy protection and security defense in software development in the power industry, a privacy protection and collaborative defense system based on artificial intelligence federated learning framework is proposed. The study adopts differential privacy technology to protect client data privacy, designs a differential privacy federation learning method based on knowledge distillation, and constructs a collaborative DNS defense system based on blockchain technology. The experimental results show that the proposed method achieves 86.7% and 95.9% security detection accuracy on MNIST and Fashion Mnist datasets, respectively, which is 4.6 and 4.5 percentage points higher compared to the FedMatch method; in terms of the accuracy rate of different types of samples, the accuracy rate of the attack event, natural event, and no-event type reaches 82%, 81%, and 95%, an improvement of 5, 8 and 5 percentage points over the FedMatch method, respectively; and significantly outperforms the traditional differential privacy mechanism in terms of model convergence speed. The study provides a new idea for data security and efficient circulation in software development in the power industry, which can effectively deal with cyber security threats and guarantee the stable operation of the power system.