Here is a simple example how to use random_split and how to access attributes of the underlying dataset:
dataset = datasets.MNIST(
    root=PATH, download=False,
    transform=transforms.ToTensor())

train_dataset, val_dataset = torch.utils.data.random_split(
    dataset, [len(dataset) - 10000, 10000])

train_loader = DataLoader(train_dataset)
val_loader = DataLoader(val_dataset)

# access underlying target directly in `datasets.MNIST`
print(dataset.targets)
# access it via .dataset in the Subset (created by random_split)
print(train_dataset.dataset.targets)
# access it via .dataset.dataset in the DataLoader
print(train_loader.dataset.dataset.targets)