The dismissal bell has never sounded sweeter than it soon will for thousands of city public-school kids.

The academic day is about to get 2 1/2 hours longer for roughly 2,000 sixth-graders in 20 middle schools for a full year come September.

The move is part of a pilot program that’s meant to boost middle-grade literacy.

The $19 million program will target sixth-grade classes for each of the next three years with mandatory afternoons of small group tutoring and other learning activities.

Participating schools have yet to be selected.

“Often, students who lose their way start to fall off track in the middle grades,” said City Council Speaker Christine Quinn, who announced the pilot at the Urban Institute of Mathematics middle school in The Bronx. “Improving our city’s middle schools is vital to helping close the achievement gap and putting kids on a better track toward educational success.”

Officials said the program would continue for participating students as they move up to the seventh and eighth grades, but by then, it would be incorporated into the regular school day.

They couldn’t explain how the extra learning would be squeezed into normal school hours, but said the logistics were being worked out.

A host of charter schools already run mandatory programs well into the late afternoon, as do a number of traditional public schools, such as Global Technology Prep — a Harlem middle school where the academic day doesn’t end until 6 p.m.

The City Council and Department of Education are each contributing $1.55 million in annual funding toward the new initiative, with matching grants from the Robin Hood Foundation and private funding groups.