If we're going to pass a law for that reason, we should pass a meaningful price on carbon. Then all the bitcoin miners using fossil-based electricity will go out of business.
But a ban on bitcoin would just relocate miners to places without the ban so I think it's a fair comparison.