You could write your custom squeeze layer.
Here is a small example:
class SqueezeLayer(nn.Module):
    def __init__(self, dim):
        super(SqueezeLayer, self).__init__()
        self.dim = dim
        
    def forward(self, x):
        return x.squeeze(self.dim)


model = nn.Sequential(
    nn.Conv3d(3, 1, 3, 1, 1),
    SqueezeLayer(1),
    nn.Conv2d(24, 6, 3, 1, 1)
)

x = torch.randn(1, 3, 24, 24, 24)
output = model(x)