We use a sample of 149 spectroscopically confirmed UV-selected galaxies at z similar to 2 to investigate the relative dust attenuation of the stellar continuum and the nebular emission lines. For each galaxy in the sample, at least one rest-frame optical emission line (H alpha/[N II] lambda 6583 or [O III] lambda 5007) measurement has been taken from the litterature, and 41 galaxies have additional Spitzer/MIPS 24 mu m observations that are used to infer infrared luminosities. We use a spectral energy distribution (SED) fitting code that predicts nebular line strengths when fitting the stellar populations of galaxies in our sample, and we perform comparisons between the predictions of our models and the observed/derived physical quantities. We find that on average our code is able to reproduce all the physical quantities (e.g., UV beta slopes, infrared luminosities, emission line fluxes), but we need to apply a higher dust correction to the nebular emission compared to the stellar emission for the largest star formation rate (SFR) (log SFR/M(circle dot)yr(-1) > 1.82, Salpeter initial mass function). We find a correlation between SFR and the difference in nebular and stellar color excesses, which could resolve the discrepant results regarding nebular dust correction at z similar to 2 from previous studies.