To address the low diagnostic accuracy stemming from imbalanced data distribution in fault diagnosis, we propose the dual-focus loss function to enhance the fault diagnosis model. First, we incorporate a regularization term into the cross-entropy to mitigate gradient disappearance caused by challenging sample distributions. Then, we merge this term with the focus loss to adjust the weight of challenging samples in the loss function, thereby enhancing the model’s attention towards them and ultimately improving diagnostic accuracy. Validation using a public dataset demonstrates the effectiveness of the model in tackling class imbalance issues in fault diagnosis.