Unravelling the influence of environment, redshift and confusion on the star formation in dusty galaxies