A federal judge dismissed all charges yesterday against two officers of a Northern Virginia construction firm accused of violating federal safety regulations in an Annandale trench cave-in that killed two young workers in 1978.

The case that U.S. District Judge D. Dortch Warriner dismissed was the initial prosecution in a federal crackdown on alleged safety violations in the sprawling Northern Virginia construction industry. Area safety officials had wide regarded it as a posibly precedent-setting case.

The judge, sitting in Alexandria, said federal prosecutors failed to show that S. O. Jennings and Bruce Jennings, top officials of the S.O.. Jennings Construction Corp. of Fairfax, "willfully and unlawfully" disregarded federal trenching regulations.

The judge also said he refused to believe key testimony given by an Occupational Safety and Health Administration investigator and found discrepancies in court testimony concerning the location of the accident as well as measurements of how the trench had been dug.

He reserved harsh criticism for the federal prosecutors, who said had straying "far afield" in presenting their case and declared that the trial was "the strangest criminal case I have every observed."

Assistant U.S. Attorney Karen Tandy, Chief prosecutor in the case, told Warriner that "what this court will do is bar criminal prosecution for failing to shore" trenches similar to the one that buried Robert Baker and Michael DeGroot, both 25, on July 18, 1978.

The Jenningses and their company were accused of digging the trench with sides that were too steep for the existing "sandy silty" soil type, failing to brace the side of the trench to protect Baker and DeGroot and prompting the collapse by operating heavy machinery nearby.

Baker and DeGroot were laying sewer pipe in the 135-foot-long trench when it collapsed, burying them.

Warriner ruled there was "more than reasonable doubt" on each of the indictments's three counts. Furthermore, he enterpreted the OSHA regulations under which the Jenningses had been charged to mean they didn't even cover the excavation in question.

The indictment referred to "trenches." Warriner rulled that the Jennings excavation was more than 15 feet wide, and therefore couldn't fit OSHA's definition of a "trench."

The precise width and depth of the trench, and the location of the accident, were disputed by several witnesses and in conclusions Warriner said he drew from court testimony, Prosecutors had attempted to show with soil analyses and trench measurements that it had been dug too steeply to be safe.

Prosecutors argued that the sewer line was being laid in "silty sandy" soil requiring the Jenningses to either shore the trench or build it in a V-shape so that it was twice as wide as it was deep.

A generally accepted dept of the trench before the cave-in was 17 feet, meaning the trench should have been at least 34 feet wide at the top.

The Jenningses acknowledged they never intended to use shoring or other protective devices, to prevent a collapse.

OSHA investigator Edward Allen, testified that on the day of the cave-in he measured the trench to be only 18 feet across. His testimony differed from that of the job foreman, who claimed the trench was at least 30 feet wide.

A Fairfax County homicide detective later testified that the foreman, Larry Cosaro, had told him the trench was as wide as the backhoe, digging it, plus about seven feet.

Although these measurements added up to 18 feet, Warner said the OSHA investigator's figures were "unbelievable." He said he replied instead on other testimony that the trench had been dug out to point five feet from surveyor's marks, placing at least one side of the ditch 15 feet from the center line.

"Apparently, nobody caught that," Warner said.

Referring to conflicting testimony on the location of the cave-in, Wariner admonished prosecutor Tandy for failing to ask key witnesses about a tree line that played a key role as a reference point.

Tandy said the person responsible for drawing a site plan for the project that might have established the location of the tree line was called by her to testify yesterday but had not been subpoenaed and left around lunchtime without her knowledge.

The judge's dismissal of the case was greeted with disgust by government officials. "When you read this decision," said OSHA investigator Allen, "you'll see it was one of the poorest decisions ever made on OSHA regulations."

Anthony Gil, a Labor Department attorney, said Warriner "misread the standard."

Government attorneys did not indicate whether the ruling will be appealed.