We present and analyse near‐infrared spectroscopy for a sample of 28 gravitationally lensed star‐forming galaxies in the redshift range 1.5 < z < 5, observed mostly with the Keck II telescope. With typical magnifications of ≃1.5–4 mag, our survey provides a valuable census of star formation rates, gas‐phase metallicities and dynamical masses for a representative sample of low‐luminosity galaxies seen at a formative period in cosmic history. We find less evolution in the mass–metallicity relation compared to earlier work that focused on more luminous systems with z∼ 2–3, especially in the low mass (∼109 M⊙) where our sample is ∼0.25 dex more metal‐rich. We interpret this offset as a result of the lower star formation rates (typically a factor of ∼10 lower) for a given stellar mass in our subluminous systems. Taking this effect into account, we conclude our objects are consistent with a fundamental metallicity relation recently proposed from unlensed observations.