The influence of random strain fields on the magnetic anisotropy of systems with Jahn-Teller (JT) ions of the iron group is investigated. The averaging of the free energy over t,he randomly distributed sources of the strain fields is carried out using two-and three-dimensional distribution functions obtained in the paper. It is shown that the value and sign of the first and second cubic anisotropy constants are determined by the ratio of the molecular field parameter to the width of the random field distribution.