Aims. Our aim is to estimate the intergalactic medium transmission towards UV-selected star-forming galaxies at redshift 4 and above and study the effect of the dust attenuation on these measurements. Methods. The ultra-violet spectrum of high redshift galaxies is a combination of their intrinsic emission and the effect of the Inter-Galactic medium (IGM) absorption along their line of sight. Using data coming from the unprecedented deep spectroscopy from the VANDELS ESO public survey carried out with the VIMOS instrument we compute both the dust extinction and the mean transmission of the IGM as well as its scatter from a set of 281 galaxies at z>3.87. Because of a degeneracy between the dust content of the galaxy and the IGM, we first estimate the stellar dust extinction parameter E(B-V) and study the result as a function of the dust prescription. Using these measurements as constraint for the spectral fit we estimate the IGM transmission Tr(Lyalpha). Both photometric and spectroscopic SED fitting are done using the SPectroscopy And photometRy fiTting tool for Astronomical aNalysis (SPARTAN) that is able to fit the spectral continuum of the galaxies as well as photometric data. Results. Using the classical Calzetti's attenuation law we find that E(B-V) goes from 0.11 at z=3.99 to 0.08 at z=5.15. These results are in very good agreement with previous measurements from the literature. We estimate the IGM transmission and find that the transmission is decreasing with increasing redshift from Tr(Lyalpha)=0.53 at z=3.99 to 0.28 at z=5.15. We also find a large standard deviation around the average transmission that is more than 0.1 at every redshift. Our results are in very good agreement with both previous measurements from AGN studies and with theoretical models.