How to create custom dataset excluding a list of images

Hi,
I am trying to create a custom dataset using the structure of ImageFolder, where the images that appear in a list are excluded from the dataset. I have modified the ImageFolder class (its getitem) to output the path to each image in the folder, and then have been trying to set an if clause that checks if each image path is in my exclusion list, otherwise to include in the output dataset. However, I am not super comfortable with the init and getitem methods and have been stuck and wanted to know what I should change in ImageFolder to implement this.
BTW, my use case is active learning to iteratively select a list of images out of a large pool, use them for retraining, and exclude them from the pool in the next round of candidate selection.
Thanks in advance for your help.