You can make custom Sampler based on torch.utils.data.WeightedRandomSampler.
I think you can set a class probability as 1 and rest of the classes 0, then in next iteration you can choose another class and set its probability 1 and rests 0, and so on.