To get the dataset name in each sample, you could return it in the __getitem__ of each Dataset.
A custom sampler might be the best approach to create batches from unique datasets and to make sure they are not mixed.