In this paper, we prove that if a metric measure space satisfies the volume doubling condition and the Hardy type inequality with the same exponent $n$ $(n\geq 3)$, then it has exactly the $n$-dimensional volume growth. Besides, three interesting applications of this fact have also been given. The first one is that we prove that complete noncompact \emph{smooth} metric measure space with non-negative weighted Ricci curvature on which the Hardy type inequality holds with the best constant are isometric to the Euclidean space with the same dimension. The second one is that we show that if a complete $n$-dimensional Finsler manifold of nonnegative $n$-Ricci curvature satisfies the Hardy type inequality with the best constant, then its flag curvature is identically zero. The last one is an interesting rigidity result, that is, we prove that if a complete $n$-dimensional Berwald space of non-negative $n$-Ricci curvature satisfies the Hardy type inequality with the best constant, then it is isometric to the Minkowski space of dimension $n$.