The development of modern oilfields has entered the middle and late stages, transforming towards digitalization and intelligence. However, the distribution of the sucker-rod pumping systems is decentralized, and the working condition information is skew-distributed. This situation poses a significant challenge to existing centralized fault diagnosis mechanisms. To address the existing practical challenge in the oilfield, a federated learning-based fault diagnosis framework for class imbalance in decentralized sucker-rod pumping systems (FL-CI) is proposed. This framework incorporates a parameter anonymization-ratio upload mechanism to mitigate the risk of gradient tracking. Then, a monitoring mechanism is leveraged to reversely infer global class-imbalance data using trained parameters uploaded by the clients. In addition, a ratio loss function is designed to calibrate the influence of class imbalance on the global system. After conducting comparative analysis, ablation analysis, and sensitivity analysis on a rod-pumping unit dataset (RPUD), as well as comparative and ablation analyses on the Case Western Reserve University bearing dataset (CWRU), the experimental results demonstrate that the FL-CI framework achieves superior diagnostic performance on the RPUD, with eight out of twelve evaluation metrics significantly outperforming seven state-of-the-art methods. A similar trend is observed on the CWRU, further validating the effectiveness and generalizability of the FL-CI.