A federal appeals court here ruled yesterday that a woman can sue her employer to stop sexual harassment and that as a result of the resistance she lost job benefits.

The decision by the U.S. Court of Appeals in Washington, reached in a case brought by a woman employed by the D.C. Department of Corrections, was viewed by legal observers yesterday as an important extension of the protections against sex discrimination that have been set out in the nation's civil rights laws.

The ruling in effect holds that sexual harassment, in and of itself, is a violation of the law and does not require further proof that the employe was penalized or lost specific job benefits.

Chief Judge J. Skelly Wright, in an unanimous opinion for the court, wrote that unless the court reached out to prohibit employers from maintaining a "discriminatory environment," the employers could "sexually harass a female employe with impunity by carefully stopping short of firing the employe or taking any other tangible actions against her in response to her resistance. . . ."

The court said that corrections department director Delbert C. Jackson should be ordered to inform all his employes that sexual harassment is illegal and must establish procedures to investigate and correct such cases.

In an unusual move, the court included a proposed order for the trial judge who originally heard the discrimination case, specifically telling Jackson in details what steps his department should take to insure that sexual harassment complaints get thorough and effective treatment.

Barry H. Gottfried, an attorney representing the woman employe, described the court decision as an "important victory" which should "also be a message to employers that this kind of [harassment] won't be tolerated." The D.C. Corporation Counsel's office, which represented the corrections department, may ask the three-judge panel to reconsider the case or ask the full 11-member court to review it.

As the law stands now, Wright wrote yesterday, a woman must prove that her resistance to sexual harassment "cost her her job or some economic benefit, but this will do her no good if her employer never takes such tangible action against her.

"Indeed, so long as women remain inferiors in the employment hierarchy, they may have little recourse against harassment," beyond getting a court order to stop such illegal activity, Wright said.

The judge noted that other "discriminatory environment" cases involving racial and ethnic discrimination have been found to violate civil rights law "in posisoning the atmosphere of employment. . . ."

"How then can sexual harassment , which injects the most demeaning sexual stereotypes into the general work environment and which always represents an intentional assault on an individual's innermost privacy, not be illegal?" Wright asked in his written opinion. Wright was joined in his decision by Washington Circuit Judge Spottswood W. Robinson and Judge Luther M. Swygert of the 7th Circuit Court of Appeals, who sat on the case by special designation.

The case involved Sandra G. Bundy, now 46 years old, who contented that she was repeatedly subjected to sexual advances by her supervisors while she worked as a vocational rehabilitation specialist for the corrections department. Bundy said yesterday that after city budget cuts last summer she was transferred to a job at the Lorton prison complex wherer she now works as a uniformed corrections officer.

In April 1979, Senior U.S. District Court Judge George L. Hart, Jr., the trial judge in the case, found that "the making of improper sexual advances to female employes [was] standard operating procedure, a fact of life, a normal condition of employment" in the corrections department. Hart also found that department director Jackson had failed either to investigate or to take seriously Bundy's complaints about sexual harassment on the job.

Nevertheless, Hart ruled that sexual harassment alone did not amount to discrimination with respect to the "terms, conditions, or privileges of employment" as described in Title VII of the Civil Rights Act of 1964. Hart refused to grant Bundy the back pay she sought on the basis of her argument that she had been denied promotions because she resisted her superiors' advances. Hart said that the corrections department had other legitimate reasons for delaying or denying Bundy her promotions.

The appeals court, in reversing Hart on both issues, said that sexual harassment could become, in effect, a "condition" of employment when a woman is forced to endure such overtures, rather than risk her job by protesting.

In addition to directing Hart to draw up an injunction barring sexual harassment, the appeals court told him to hold further hearings on Bundy's back pay and promotion claims.