Teachers and their unions have long complained that educators are undervalued and underpaid. A new study of public-school pay seeks to show by just how much and warns of a worsening problem that could make it harder to find and keep good teachers.

The study, being released just in time for the school year’s start, found the pay gap between public-school teachers and similar professionals is wider than ever, with teachers on the losing end of it.

Public-school teachers last year made 17% less in weekly wages than other workers with similar education levels and years of experience, compared with just 4% less in 1996, according to the study published by the Economic Policy Institute, a left-leaning think tank partly funded by teachers’ unions.

Since 1996, teachers’ average weekly inflation-adjusted wages have fallen $30 to $1,092 in 2015, while the weekly average for all other college graduates has risen $124 to $1,416, the study found.

“Teachers face low wages, high levels of student debt, and increasing demands on the job. Eliminating the teacher-pay penalty is crucial to building the teacher workforce we need,” said economist Lawrence Mishel, president of the Economic Policy Institute and a co-author of the study along with EPI research associate Sylvia Allegretto, an economist at the University of California, Berkeley.

While unions have managed to mitigate the divide (the pay gap for teachers in unions is six percentage points narrower than for other teachers) they haven’t been able to close it completely.

The study isn’t based on occupational comparisons, but rather, comparisons between teachers and workers with similar levels of education and years of experience, Mr. Mishel said. He said he has done previous studies comparing teachers with occupations deemed similar, such as reporters, accountants and underwriters, and came up with similar findings.

For the latest study, the authors used data from the Department of Labor’s Bureau of Labor Statistics. That included the Current Population Survey to help them analyze wages and the Employer Costs for Employee Compensation survey for their analysis of workers’ benefits.

Benefits are a bright side for teachers, who on average get better benefits packages than similar workers, the researchers found. But even when including benefits, teachers’ total compensation was 11% less than similar workers last year on a weekly basis.

It hasn’t always been this way. In 1960, female teachers made 14.7% more a week than comparable female workers, compared with 13.9% less a week in 2015. The 1960 premium had disappeared by 1980 and turned sharply negative over the last 20 years, Mr. Mishel said. Wages for experienced teachers eroded more than at the entry level.

The latest economic downturn didn’t help. At the start of it, teachers’ pay improved relative to similar workers, due at least in part to union contracts that helped protect teachers’ compensation. But once those pacts expired, state budget cuts and teacher layoffs took a toll. The teacher-pay gap may have widened some during those years because of teachers who forewent raises to maintain certain benefits.

The authors believe the pay gap has already contributed to attrition rates among teachers and a declining interest in the profession. They cited one recent study that found just 5% of students headed to college were interested in the field of education.