The Supreme Court agreed yesterday to decide whether a federal law making it a crime to escape from a jail is violated if an inmate's motive was to avoid intolerable conditions.

The case arose from the escape of four men from the new D.C. Jail in August 1976. The four were captured, tried and convicted of escape and sentenced to five-year prison terms to be served after completion of their original sentences.

Last July, however, the U.S. Court of Appeals here reversed the convictions and ordered new trials. The Justice Department then asked the Supreme Court to review the case.

A key issue is what constitutes an intent to violate the escape law.

In instructing the jury, the U.S. District Court Judge Oliver Gasch gave intent to escape its commonplace meaning: a prisoner generally intends, consciously and willfully, to flee confinement and not return. Gasch told the jury that jail conditions were not a defense to escape charges, but the appeals court disagreed.

In the opinion for a 2-to-1 majority, U.S. Circuit Chief Judge J. Skelly Wright said that where the defense offers "evidence of jail conditions, threats and violence" such as that presented about the District facility, it is at least questionable whether an escape was motivated by an intent to avoid "confinement" as opposed to an intent to avoid poor jail conditions.

"If a prisoner offers evidence to show that he left confinement only to avoid conditions that are not normal aspects of 'confinement' -- such as beatings in reprisal for testimony in a trial, failure to provide essential medical care, or homosexual attacks -- the intent element of the crime of escape may not be satisfied," Wright said. Wright was joined in his opinion by U.S. Circuit Judge Carl McGowan.

At the trial, Judge Gasch allowed the defendants to offer evidence of harsh conditions, such as threats and beatings by guards, poor ventilation, frequent fires that burned themselves 3ut and allegations that one of the inmates was denied medical treatment.

The ruling elicited a strong dissent from Circuit Judge Malcolm R. Wilkey who accused the majority of issuing a ruling that would make "a mockery" of the escape law. He emphasized that the evidence contained nothing to suggest that the defendants had faced any imminent threat of serious bodily injury or death.

In the government's petition to the Supreme Court for review, Solicitor General Wade H. McCree Jr. said that the ruling "departed radically from prior analysis of the crime of escape," has "no support" in the law, conflicts with numerous decisions in both the federal and state courts, and "converts the crime... into a self-help remedy for undersirable prison conditions."