CONGRESS HAS JUST VOTED to prohibit any dumping of sewage sludge in the oceans after 1981. It's a good move. Federal and state authorities have had a terrible time trying to persuade Philadelphia, New York and other cities to find alternatives to shipping their sludge out to sea. Enacting an out-right ban appears to be the only way to get the message through that the oceans may not be used indefinitely as convenient dumping grounds.

The next question, of course, is where the sludge should go instead. This is a growing problem here and elswhere because better sewage-treatment plants generate much more sludge. Burying it in landfills is wasteful and usually unpopular. Incineration costs a lot, wastes energy and produces pollution.What to do?

One answer is to turn the waste into a useful compost. This is hardly a new idea; the city of Milwaukee has been selling treated sludge as Miloganite soil conditioner for decades. Indeed, the principle is as ancient as the use of "night soil" as fertilizer. However,in the era of indoor plumbing, elaborate sewage-treatment systems and better farming through chemicals, the concept of spreading sludge on the land has come to sound, well distasteful and crude.

After four years of work at Beltsville, though, the Maryland Environmental Service and the U.S. Agriculture Department have come up with a successful and fairly simple way to compost sludge from this area's Blue Plains treatment plant. The result is an odorless, uncontaminated, peaty product that is good and safe for use in farming, gardening, landscaping and reclaiming barren ground. The National Park Service's Constitution Gardens, near the Lincoln Memorial, is one place where the compost has already proved its worth.

Maryland officials are so pleased with the process that they have just unveiled a plan to treat most of the Blue Plains sludge at a proposed regional composting facility in Charles County. Meanwhile, the Montgomery County Council has approved a site for composting that county's sludge in an industrial area near Route 29. If these programs get all the necessary go-aheads and funds and are properly run, they could bring a happy end to the regional "sludge wars" that have dogged every phase of improving Blue Plains. Beyond that, this cooperative approach should show other metropolitan areas how a persistent problem might be solved. Composted sludge from industrial cities such as Baltimore and Philadephia might not be fit for farming, because traces of heavy metals would remain. Even so, it could help restore roadsides, parks, and strip-mined land. Surely that is more beneficial than polluting the seas.