  (Abridged) We aim to study the evolution of dust attenuation in galaxies
selected in the IR in the redshift range in which they are known to dominate
the star formation activity in the universe. The comparison with other
measurements of dust attenuation in samples selected using different criteria
will give us a global picture of the attenuation at work in star-forming
galaxies and its evolution with redshift. Using multiple filters of IRC
instrument, we selected more than 4000 galaxies from their rest-frame emission
at 8 microns, from z~0.2 to 2$. We built SEDs from the rest-frame UV to the
far-IR by adding data in the optical-NIR and from GALEX and Herschel surveys.
We fit SEDs with the physically-motivated code CIGALE. We test different
templates for AGNs and recipes for dust attenuation and estimate stellar
masses, SFRs, amount of dust attenuation, and AGN contribution to the total IR
luminosity. The AGN contribution to the total IR luminosity is found to be on
average approximately 10% with a slight increase with redshift. Dust
attenuation in galaxies dominating the IR luminosity function is found to
increase from z=0 to z=1 and to remain almost constant from z=1 to z=1.5.
Conversely, when galaxies are selected at a fixed IR luminosity, their dust
attenuation slightly decreases as redshift increases but with a large
dispersion. The attenuation in our mid-IR selected sample is found ~ 2 mag
higher than that found globally in the universe or in UV and Halpha line
selections in the same redshift range. This difference is well explained by an
increase of dust attenuation with the stellar mass, in global agreement with
other recent studies. Starbursting galaxies do not systematically exhibit a
high attenuation
