A U.S. District Court judge ruled yesterday that the Environmental Protection Agency should consider the nation's 2 million dams potential sources of pollution, should establish standards for the quality of water flowing out of them and should require any dams that cause pollution to get appropriate federal permits.

"Since the Clean Water Act cannot achieve its goals without attacking all pollution sources, dams cannot simply be ignored," Judge Joyce Hens Green wrote in her 35-page opinion.

"There is no question," she continued at a later point, "that the operation of the dam creates certain pollutant s and adds them to navigable water, and that effluent limits could be achieved by the application of technology . . . . "

The decision was a victory for the National Wildlife Federation, which brought the case in 1979. It could mean significant problems for both the electric power industry, which uses more than 1,000 dams nationwide, and for the EPA, which would have new work to do when it is suffering budget and personnel cuts.

However, attorneys for the EPA and some 80 power companies who intervened in the case said it was too early to assess the impact of the decision. William Ellis, an attorney for the power companies, including New York's Consolidated Edison Co., Chicago's Commonwealth Edison, the Dallas Power & Light Co. and the Potomac Electric Power Co., said "the bottom line on the costs is that they could be substantial."

One knowledgeable official at the EPA who asked not to be identified said it would be difficult to establish one categorical rule for all dams, because the effects of a dam on a given waterway differ greatly depending on the size of the dam, the size of the reservoir and whether the runoff flows over the dam spillway from a pipe at its base or from some other point.

The EPA did not dispute the National Wildlife Federation's contention that dams can alter the water passing through them. For example, water pouring over a dam's top into a holding basin below can become saturated with common gases, forming bubbles that can kill fish.

However, for years EPA has considered dams, in effect, a part of the river. If there was pollution downstream that had not been present upstream, the EPA argued that the river was polluting itself.

Dams, the agency argued in court, should not be subject to the same "point source" regulations as factories, steel mills or sewage treatment plants.

This was the contention that Green explicitly rejected in giving the agency 90 days to produce new regulations controlling the pollution from dams.