We study the effects of the local environment on the molecular gas content of a large sample of log(M * /M ⊙ ) 10 star-forming and starburst galaxies with specific star-formation rates (sSFRs) on and above the main-sequence (MS) to z ∼ 3.5. ALMA observations of the dust continuum in the COSMOS field are used to estimate molecular gas masses at z ≈ 0.5-3.5. We also use a local universe sample from the ALFALFA HI survey after converting it to molecular masses. The molecular mass (M ISM ) scaling relation shows a dependence on z, M * , and sSFR relative to the MS, but no dependence on environmental overdensity ∆ (M ISM ∝ ∆ 0.03 ). Similarly, gas mass fraction (f gas ) and depletion timescale (τ ) show no environmental dependence to z ∼ 3.5. At z ∼ 1.8, the average M ISM , f gas , and τ in densest regions is (1.6±0.2)×10 11 M ⊙ , 55±2%, and 0.8±0.1 Gyr, respectively, similar to those in the lowest density bin. Independent of the environment, f gas decreases and τ increases with increasing cosmic time. Cosmic molecular mass density (ρ) in the lowest density bins peaks at z ∼ 1-2 and this peak happens at z < 1 in densest bins. This differential evolution of ρ across environments is likely due to the growth of the large-scale structure with cosmic time. Our results suggest that the molecular gas content and the subsequent star-formation activity of log(M * /M ⊙ ) 10 star-forming and starburst galaxies is primarily driven by internal processes, not their local environment since z ∼ 3.5.