Gearboxes, as a key component of mechanical drive systems, encounter problems of data leakage and low model accuracy when employing traditional fault diagnosis methods in terms of limited labeled data and data privacy protection requirements. Therefore, this study proposes a privacy-preserving framework based on federated learning using a small-sample gearbox fault diagnosis method that combines semi-supervised prototype networks with comparative learning. Initially, the DeceFL federated learning framework is constructed to produce positive and negative sample pairs using a limited number of labeled samples for each