It’s unlikely that your model has only seen samples from classes 0 to 5, if you’ve shuffled the dataset.
Even though you are only using approx. 10% of the dataset, the batches should be well shuffled.
Here is a small example:
dataset = datasets.MNIST(root='./data',
                         transform=transforms.ToTensor())
loader = DataLoader(dataset, batch_size=64, shuffle=True)

targets = []
for idx, (data, target) in enumerate(loader):
    targets.append(target)
    if idx >= 99:
        break

targets = torch.cat(targets)
print(targets.shape)
> torch.Size([6400])
print(targets.unique(return_counts=True))
>(tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), tensor([634, 666, 657, 666, 606, 579, 629, 684, 637, 642]))

As you can see, each class has approx. the same number of samples, which should avoid overfitting to a subset of the classes.
The overfitting might be a result of another code part. Are you manipulating the data in some other way?