Machine learning contributes to environmental sustainability by optimizing energy efficiency, predicting climate changes, analyzing environmental data, improving waste management, and optimizing renewable energy systems.