Recently, deep neural networks have shown remarkable success in fault diagnosis in power systems using partial discharges (PDs), thereby enhancing grid asset safety and reliability. However, the prevailing approaches often adopt centralized large-scale datasets for training, without taking into account the impact of noise environments for Intelligent Electronic Devices (IEDs). Noise environments for PD measurements in gas-insulated switchgear (GIS) introduce variations in feature distributions and class representations, challenging the generalization ability of the trained models in new and diverse conditions. In this study, we propose a Shared Knowledge-based Contrastive Federated Learning (SK-CFL) for PD diagnosis in different noise environments for IEDs. The proposed SK-CFL combines federated learning principles with contrastive learning, empowering IEDs to collaboratively learn and share knowledge as regards PD and noise patterns. The proposed framework can learn representations between the same patterns across different IEDs while ensuring data privacy. Experimental results for PD diagnosis in GIS show that the proposed SK-CFL achieves a performance improvement in fault diagnosis, particularly in new and unseen environments. Specifically, the recall for unknown noise in untrained IED 6 demonstrates 92.86% of the proposed SK-CFL, in comparison with 64.29% and 35.71% of the conventional FL and baseline method, respectively. These results suggest that the proposed SK-CFL approach promises more adaptable, and resilient data-driven approaches since it protects data privacy that can operate effectively in challenging real-world environments.