Beyond the spin model approximation for Ramsey spectroscopy