The DataLoader does not create the labels, but just wraps a Dataset to create batches, shuffle the samples, use multiple workers, etc.
If you are using something like torchvision.datasets.ImageFolder, the labels are created in the _find_classes method 2.
Basically it scans the directories and assigns an integer to each dir.