Hey @Nikolaos_Sintoris
I tried with a simple implementation of the code you have provided.
The ConcatDataset has a .datasets attribute that lists all the datasets that are concatenated. This helps in the demarcation of all the labels. You would need to iterate on all the datasets in the ConcatDataset each having its own set of labels.
Hope this helps you.

Code to reproduce
$ mkdir A B C
$ mkdir A/sub_1 A/sub_2 A/sub_3
$ mkdir B/sub_1 B/sub_2 B/sub_3
$ mkdir C/sub_1 C/sub_2 C/sub_3

Creating random images in each sub folder
for folder in ["A", "B", "C"]:
    for sub_folder in os.listdir(folder):
        for i in range(10):
            img = np.random.random((20,20))
            plt.imsave(arr=img, fname=f"{folder}/{sub_folder}/img_{i}.png")

Using the code snippet provided by you
A_dataset = torchvision.datasets.ImageFolder(root = "A" , transform = torchvision.transforms.ToTensor())
B_dataset = torchvision.datasets.ImageFolder(root = "B" , transform = torchvision.transforms.ToTensor())
C_dataset = torchvision.datasets.ImageFolder(root = "C" , transform = torchvision.transforms.ToTensor())

all_datasets = []
all_datasets.append(A_dataset)
all_datasets.append(B_dataset)
all_datasets.append(C_dataset)

final_training_dataset = torch.utils.data.ConcatDataset(all_datasets)

The sanity check
for dataset in final_training_dataset.datasets:
    print(dataset.root)
    print(dataset.classes)

Result:
A
['sub_1', 'sub_2', 'sub_3']
B
['sub_1', 'sub_2', 'sub_3']
C
['sub_1', 'sub_2', 'sub_3']