A popular Bethpage, LI, teacher who was fired for letting students stage racy rap battles — and even spitting a few verses himself — is suing for his job back.

John F. Kennedy Middle School teacher and lacrosse coach Brian Hennen, 43, was canned after players waged raunchy hip-hop combat on team bus rides last May, according to Nassau County Supreme Court papers.

“Students would make fun of each other and the insults ‘rapped’ were, at times, highly inappropriate and offensive . . . about race, religious background, weight, etc.,” the district argued.

But Hennen’s union representative — who stressed his unblemished 20-year record — said the firing was a gross overreaction.

The controversy erupted when teachers found two players with vulgar pre-written rap lyrics. Hennen said no kids ever complained.