Gas inflow feeds galaxies with low-metallicity gas from the cosmic web, sustaining star formation across the Hubble time.We make a connection between these inflows and metallicity inhomogeneities in star-forming galaxies, by using synthetic narrow-band images of the Ha emission line from zoom-in AMR cosmological simulations of galaxies with stellar masses of M* ∼ 109 M⊙ at redshifts z = 2-7. In ~50 per cent of the cases at redshifts lower than 4, the gas inflow gives rise to star-forming, Ha-bright, off-centre clumps. Most of these clumps have gas metallicities, weighted by Ha luminosity, lower than the metallicity in the surrounding interstellar medium by ~0.3 dex, consistent with observations of chemical inhomogeneities at high and low redshifts. Due to metal mixing by shear and turbulence, these metallicity drops are dissolved in a few disc dynamical times. Therefore, they can be considered as evidence for rapid gas accretion coming from cosmological inflow of pristine gas.