Stellar activity strongly affects and may prevent the detection of Earth-mass planets in the habitable zone of solar-type stars with radial velocity technics. Astrometry is in principle less sensitive to stellar activity because the situation is more favourable: the stellar astrometric signal is expected to be fainter than the planetary astrometric signal compared to radial velocities. We quantify the effect of stellar activity on high-precision astrometry when Earth-mass planets are searched for in the habitable zone around old main-sequence solar-type stars. We used a very large set of magnetic activity synthetic time series to characterise the properties of the stellar astrometric signal. We then studied the detectability of exoplanets based on different approaches: first based on the theoretical level of false positives derived from the synthetic time series, and then with blind tests for old main-sequence F6-K4 stars. The amplitude of the signal can be up to a few times the solar value depending on the assumptions made for activity level, spectral type, and spot contrast. The detection rates for 1 MEarth planets are very good, however, with extremely low false-positive rates in the habitable zone for stars in the F6-K4 range at 10 pc. The standard false-alarm probability using classical bootstrapping on the time series strongly overestimates the false-positive level. This affects the detection rates. We conclude that if technological challenges can be overcome and very high precision is reached, astrometry is much more suitable for detecting Earth-mass planets in the habitable zone around nearby solar-type stars than radial velocity, and detection rates are much higher for this range of planetary masses and periods when astrometric techniques are used than with radial velocity techniques.