You could e.g. create a custom find_classes method and pass it to DatasetFolder as described here.
find_classes
DatasetFolder