If each folder contains images from a separate class, you could use torchvision.datasets.ImageFolder.
To split the dataset to a training, validation, and test set you could use Subset or SubsetRandomSampler.