The Army and Shell Oil Co. agreed yesterday to spend as much as $1 billion to remove hazardous wastes discharged since the 1950s at the Army's Rocky Mountain Arsenal, 10 miles north of Denver.

The agreement, filed by the Justice Department in U.S. District Court in Denver, represents the costliest toxic-waste cleanup negotiated by the government and foreshadows the scale of public-works projects believed necessary to restore the environment of dozens of polluted military bases nationwide.

Rocky Mountain produced chemical weapons in the 1950s and 1960s. The Army leased base buildings and equipment to Shell in 1952 for manufacture of pesticides.

According to Justice Department officials, the Army and Shell discharged liquid wastes into open lagoons dug on the facility. Toxic substances burrowed into the ground, forcing neighboring farmers and residents to use alternative water sources in the 1970s. The contaminants have not reached but threaten deeper drinking water sources for metropolitan Denver.

Water and fish of four artificial lakes south of the Shell plant also are polluted, officials said.

The pollutants include aldrin and dieldrin, pesticides banned for agricultural uses after producing cancer in mice. Also found were arsenic and mercury, a carcinogen and central nervous system poison, respectively.

"It is an extremely large site with a significant quantity of chemicals that need to be cleaned up to protect the human community and the environment," said Roger J. Marzulla, acting assistant attorney general who heads the Justice Department's Land and Natural Resources Division.

In signing the consent decree, Shell became the first company to assume partial responsibility for cleanup of a military facility. The firm, which stopped pesticide production at Rocky Mountain in 1982, issued a statement saying it has always performed in a "responsible manner" and was required by its lease to "discharge its waste into facilities owned and operated by the Army."

Lt. Col. John Chapla, an Army spokesman, said that, while officers believed at the time that they were adopting "accepted techniques" of disposal, "there's no question we were a polluter. We are in the process of making right what went wrong."

"Unfortunately, that's going to cost the taxpayers some money," he said.

Yesterday's agreement comes in a 1983 suit by the Army, Justice Department and Environmental Protection Agency aimed at forcing Shell to share costs of cleanup and lingering natural resources damage.

The Army estimates that cleaning the ground water and excavating contaminated soil will cost between $750 million and $1 billion. The job is expected to take at least 12 years.

Under the agreement, Shell will pay half of the first $500 million in cleanup, 35 percent of the next $200 million and 20 percent of costs above $700 million. The Army's share is larger, officials said, because it owned and operated the disposal facility and its pollution is more difficult to treat.

The most expensive cleanup previously negotiated by the Justice Department was a $70 million to $90 million job by Westinghouse Electric Corp. at six hazardous-waste sites in Indiana three years ago.

The Army has agreed to render the 27-square mile base clean enough to permit commercial and industrial development, recreation and wildlife preservation. A long-term cleanup plan by the Army and Shell is to be supervised by the EPA.

In the meantime, Shell and the Army have agreed to 13 actions to alleviate the most pressing pollution problems, officials said. These include removal of liquids and waste from the arsenal's largest disposal lagoon and construction of three ground water treatment systems.

Rocky Mountain is the largest of 32 military installations slated for cleanup under the EPA's Superfund program.