We make use of SHARDS, an ultra-deep (<26.5AB) galaxy survey that provides optical photo-spectra at resolution R~50, via medium band filters (FWHM~150A). This dataset is combined with ancillary optical and NIR fluxes to constrain the dust attenuation law in the rest-frame NUV region of star-forming galaxies within the redshift window 1.5<z<3. We focus on the NUV bump strength (B) and the total-to-selective extinction ratio (Rv), targeting a sample of 1,753 galaxies. By comparing the data with a set of population synthesis models coupled to a parametric dust attenuation law, we constrain Rv and B, as well as the colour excess, E(B-V). We find a correlation between Rv and B, that can be interpreted either as a result of the grain size distribution, or a variation of the dust geometry among galaxies. According to the former, small dust grains are associated with a stronger NUV bump. The latter would lead to a range of clumpiness in the distribution of dust within the interstellar medium of star-forming galaxies. The observed wide range of NUV bump strengths can lead to a systematic in the interpretation of the UV slope ($beta$) typically used to characterize the dust content. In this study we quantify these variations, concluding that the effects are $Deltabeta$~0.4.