It’s a story that is all too familiar in Japan: A middle-school girl who is a natural brunette is told to dye her hair black by a teacher, citing a school rule. Instead of complying, the student stops coming to class, another victim of Japanese education’s rigidly conformist mindset.

But rather than turn this story into an earnest social problem drama, Yuichiro Sakashita has scripted and directed “Blonde,” a talky and narratively baggy comedy that nonetheless delivers biting commentary about everything from the byzantine rituals of Japanese school politics to the plight of eternal Peter Pan types who look on adulthood with undisguised horror.

The winner of the Audience Award at this year’s Tokyo International Film Festival, where it screened in competition, “Blonde” takes the risk of centering on a protagonist we’re meant to despise — at least until the third act offers reasons to reconsider. The gamble pays off, if only just, mainly because he finds a foil and finally an ally in a student with an admirably strong spine, though she is hardly flawless.