You can add the dimension via tensor = tensor.unsqueeze(2), but this would only add this dimension with a size of 1.
I don’t know how this dimension should be filled, but if you would like to use multiple image tensors and stack them in this dimension, you could use:
data = [torch.randn(1, 3, 24, 24) for _ in range(10)]
x = torch.stack(data, dim=2)
print(x.shape)
> torch.Size([1, 3, 10, 24, 24])