This paper studies the magnitude homology of graphs focusing mainly on the relationship between its diagonality and the girth. The magnitude and magnitude homology are formulations of the Euler characteristic and the corresponding homology, respectively, for finite metric spaces, first introduced by Leinster and Hepworth–Willerton. Several authors study them restricting to graphs with path metric, and some properties which are similar to the ordinary homology theory have come to light. However, the whole picture of their behaviour is still unrevealed, and it is expected that they catch some geometric properties of graphs. In this article, we show that the girth of graphs partially determines the magnitude homology, that is, the larger girth a graph has, the more homologies near the diagonal part vanish. Furthermore, applying this result to a typical random graph, we investigate how the diagonality of graphs varies statistically as the edge density increases. In particular, we show that there exists a phase transition phenomenon for the diagonality.