You can take a look at the source code here if it helps:

  
      pytorch.org
  
  
    

torch.distributions.multivariate_normal — PyTorch 1.7.0 documentation 6



  
  
    
    
  
  


They calculate squared Mahalanobis distance in _batch_mahalanobis().