CHICAGO (AP) _ A principal who once held the second-ranking post in the city's public school system was falsely accused of trading academic help for sexual favors because he was a strict disciplinarian, a defense lawyer said Tuesday.

The assertions came as lawyers for suspended Kelvyn Park High Principal James G. Moffat rested their case in Cook County Circuit Court.

Moffat, 58, a former deputy superintendent of the Chicago public schools, is charged with official misconduct and taking indecent liberties with children.

Four male students and one female testified they engaged in sexual activity with Moffat in his office between 1982 and 1984 after he promised to help them with their grades.

Defense lawyer Lawrence O'Gara said that four of the students who testified against Moffat were friends who were enaging in sex with another teacher, but tried to frame Moffat because he discovered their activities.

He also contended Moffat became unpopular because he ordered the campus closed and frequently disciplined teachers.

Moffat testified Monday, and Assistant State's Attorney John Farrell tried to portray him as a predator who selected students for their vulnerability.

Referring to one student who testified he twice engaged in sex with Moffat to avoid flunking out, Farrell asked Moffat, ''Didn't you know he had a father who threatened to beat him if he flunked out of school?''

''I didn't know he had a father,'' Moffat said. ''I know he listed his mother and brother as his legal guardian.''

Asked why he would remember such a point, Moffat said: ''I remember many students and who they listed as guardians. I would certainly remember him.''

Moffat has spent 30 years in education as a teacher, principal and administrator.

He was promoted in 1968 to assistant superintendent in charge of federally funded programs. That job often placed him at the center of controversy over how federal funds were spent in impoverished neighborhoods.

When former Chicago Superintendent Joseph P. Hannon proposed Moffat as one of four deputy superintendents, the Rev. Jesse Jackson said Moffat was ''unanimously objectionable'' because ''his relationship with parents has been bad.''

However, Hannon succeeded in having him appointed.

The school board demoted Moffat to principal in 1980 without explanation.

The trial was to continue Wednesday.