answering to myself, here’s the solution I came up with. It amounts to creating a loader for each class, and using all those loaders for each batch:
    dataset = datasets.ImageFolder(
        my_rootfolder,
        transform=my_transforms)
    # now create the loaders for the different classes
    loaders = []
    for class_name in dataset.classes:
        # get the indices in the dataset that are relative to that class
        idx = [
            pos for pos, item in enumerate(dataset.samples)
            if item[1] == dataset.class_to_idx[class_name]]
        # construct the corresponding dataloader thanks to a SubsetRandomSampler
        loaders += [torchdata.DataLoader(
            dataset, batch_size=args.batch_size,
            sampler = torchdata.sampler.SubsetRandomSampler(idx),
            **kwargs)]


    # now using the thing:
    for items in zip(*loaders):
        # items[idx] is the batch for class idx,
        # ...