Here is an alternative. Use fastai_datasets 17 to get your CIFAR100 dataset. The reason being it provides data in Imagenet form i.e. every class/label image are in their separate folders and you can just delete the folders/classes that you do not want.
To create your dataset you would use ImageFolder 11, and the rest is same.
I think PyTorch provides CIFAR dataset in some batched or pickle form (I have not used this, so I am not fully sure). If you want to use this, then it will involve more work. The basic idea being you would have to iterate over the complete dataloader and use if conditions to select only those tensors that belong to your class. Now you can store these tensors in another tensor, and then you can save them to disk for future use.