We study the magnetic-field dependence of the interactions between two alkaline-earth(-like) Rydberg atoms, 88{}^{88}Sr and 174{}^{174}Yb. Considering the pair of Rydberg states ns,3S1,mJ|ns,{}^3S_1,m_J\rangle and (n+1)s,3S1,mJ|(n+1)s,{}^3S_1,m_J\rangle, we show that the effective Hamiltonian takes the form of an {\it XXZ}-type quantum spin model, as in the alkali-atom case [M. Kunimi and T. Tomita, Phys. Rev. A {\bf 112}, L051301 (2025)]. We find that the behavior of the anisotropy parameter for 174{}^{174}Yb at z