Average salaries for teachers in the District remained the second highest in the country last year, while Maryland and Virginia moved up in a comparison released yesterday by the American Federation of Teachers.

Average teacher salaries in the District rose a modest 1.8 percent to $33,801 last year, topped only by Alaska, which had an average salary of $46,063. South Dakota had the lowest average, $18,781, according to the report.

Maryland ranked eighth, with an average teacher salary of $28,893, a 7.8 percent increase from last year. Virginia's salaries rose 5.8 percent to $25,473, putting the state 25th in the country and first in the Southeast.

D.C. Board of Education President R. David Hall said the District's salary average is high because of its large percentage of veteran teachers; he added that salaries for starting teachers in the District are generally lower than those of other local jurisdictions.

Nationwide, the average teacher salary increased 5.7 percent to $26,698 last year, the 58-page report said. AFT officials used the announcement to attack the longstanding disparity between teachers' salaries and those of other professions and to press for greater autonomy for schoolteachers.

"People don't go into teaching to become millionaires. We know that," said Jewell Gould, director of research for AFT. "Unless we can equal the working and salary conditions in other fields, there will not be enough quality teachers to fill the nation's classrooms."

In the past five years, Maryland's salaries rose from 12th in the nation to eighth.

The District has kept its No. 2 position since 1980-81, while in the same period, Virginia has climbed from 34th to 25th.

The major reason for Virginia's increase is a state law requiring localities to raise average teacher pay by 10 percent in both the 1986-87 and 1987-88 school years or risk losing state funds of $73 per pupil, officials said.

School systems with average salaries above $24,537 -- which includes all those in Northern Virginia -- are exempt from the provisions of the law.

Officials said the recent gains in salaries resulted from teachers staying longer in jobs and from layoffs of beginning teachers in the late 1970s. The report said the typical teacher in 1987 has 17 years' experience, more than at any time in the past 30 years.

Salaries for beginning teachers rose 7.1 percent nationwide to an average of $17,800. AFT officials said that liberal arts graduates who do not go into teaching still earn 19 percent more than teachers.