A detailed study of the $g$-factor anisotropy of electrons and holes in InAs/In$_{0.53}$Al$_{0.24}$Ga$_{0.23}$As self-assembled quantum dots emitting in the telecom spectral range of $1.5-1.6$ $mu$m (around 0.8 eV photon energy) is performed by time-resolved pump-probe ellipticity technique using a superconducting vector magnet. All components of the $g$-factor tensors are measured, including their spread in the quantum dot (QD) ensemble. Surprisingly, the electron $g$ factor shows a large anisotropy changing from $g_{mathrm{e},x}= -1.63$ to $g_{mathrm{e},z}= -2.52$ between directions perpendicular and parallel to the dot growth axis, respectively, at an energy of 0.82 eV. The hole $g$-factor anisotropy at this energy is even stronger: $|g_{text{h},x}|= 0.64$ and $|g_{text{h},z}|= 2.29$. On the other hand, the in-plane anisotropies of electron and hole $g$ factors are small. The pronounced out-of-plane anisotropy is also observed for the spread of the $g$ factors, determined from the spin dephasing time. The hole longitudinal $g$ factors are described with a theoretical model that allows us to estimate the QD parameters. We find that the QD height-to-diameter ratio increases while the indium composition decreases with increasing QD emission energy.