If it is, then shutting it down would cut off an enemy's economic resources and force them to choose between an angry population and attacking a fortified position against air superiority.
Yes, being without electricity does great harm to the civilian population, but less harm than a massacre-by-flood.
Easy to say when the sluice gates are stuck and the dam represents more than 10% of the country's already way under demand electricity production.