Internally ImageFolder creates these paths, so the one approach would be to only have one subfolder inside root containing your desired class images.
Every other approach would make the usage of ImageFolder not really useful, as you would have to filter out the other unwanted classes.
A kind of dirty hack would be to use ImageFolder, and increase the index inside __getitem__ until you sample an image from the class you want.