When considering a goodly portion of Woody Allen’s filmography, Matthew McConaughey’s career-making quip from “Dazed and Confused” springs to mind: “That's what I love about these high school girls, man. I get older, they stay the same age.”

In too many of Allen’s movies, the men are middle-aged or older, and the women are invariably pretty young things, barely nubile. In his latest, “Magic in the Moonlight,” the customarily implausible romantic leads are the 54-year-old Colin Firth and the 26-year-old Emma Stone.

Allen’s age-defying chauvinism first reared its ugly head as far back as “Manhattan,” but at least that film had the moral protection of being a masterpiece. “Magic in the Moonlight” is far from it; it’s fairly amusing, it looks gorgeous, and it affectionately evokes movies from another period, but it’s as inconsequential as anything he’s ever directed.

It’s set in the Jazz Age, where Firth plays Stanley, an irascible illusionist who performs as a hilariously offensive Asian stereotype named Wei Ling Soo. He’s introduced this way, disappearing into a sarcophagus and reappearing in a throne. As soon he de-wigs, we see that he’s a deep-seated pessimist with an acrid tongue and, as his solitary friend puts it, “all the charm of a typhus epidemic.”

After the show, this friend, fellow-magician Howard (Simon McBurney), comes to Stanley with a proposition: Stanley, being a famous debunker of fraudulent spiritualists, should visit Howard’s relatives in the south of France, who have fallen under the trance of the most accurate medium he’s ever encountered. Come see her, he says, and work your own magic—prove that she’s a charlatan where I couldn’t. So Stanley drops everything to meet the professed psychic Sophie (Emma Stone) and his friend’s family, on the banks of French Riviera (oh, what a life).

Stanley is immediately taken with Sophie, and they are an agreeably disagreeable rom-com pair: a grouchy man of science and a starry-eyed woo-woo; when she calls a sunset landscape “beautiful,” he calls it “transient.” But the more time he spends with her, the more facts she seems to know about his past, and the more inexplicable her séance revelations become, gradually breaking down his rationalism and forcing him to believe in something beyond himself. Could they also be falling in love?

Stanley has a (more age-appropriate) fiancée, and Sophie, too, has a rival suitor—Brice (Hamish Linklater), the affluent scion of the family that has taken Sophie under its wing. But Allen has written him into a caricatured dead end; Brice a milquetoast puppy-dog who serenades her with obnoxious ukulele ballads, and is in no believable way competition for Stanley. Allen should know better than to write in such a thin narrative punching bag.

“Magic in the Moonlight” is at its best when Firth and Stone match wits and gently spar—when we, along with Stanley, try to determine her fraudulence or legitimacy. If you can cast aside the age difference, there is a genuine chemistry here, and Stone’s dramatic overacting when she receives “mental impressions” is actually delightful. Firth is as funny as he has ever been, and the pair of them come off like Cary Grant and Claudette Colbert in a ‘30s comedy, Allen flirting with the vintage screwball tradition without fully succumbing to it.

The antiquated setting does the film, and Allen’s writing, a service. His contemporary films often contain anachronistic dialogue that rings false, but in the Gatsby era, he’s free to use words like “milksop,” “chicanery” and “scoundrel,” and the actors have a great time uttering them.

But all good things, including the movie’s essential mystery, must come to an end, and when it does, we’re left with a routine romantic comedy that goes through the motions, sputtering pedantically toward the inevitable—which in this case is an older man trying to win the affections a girl who could be his daughter. When the moonlight overtakes the magic, it illuminates the film for the transparent fantasy it is, and it’s a lazy, improbable sight.

“Magic in the Moonlight” is now playing at Cinemark Palace, Regal Shadowood and Living Room Theaters in Boca Raton, Movies of Delray, Cinemark Boynton Beach, the Classic Gateway Theater in Fort Lauderdale, Cinemark Paradise in Davie, AMC Aventura, Regal South Beach and AMC Sunset Place in South Miami. It opens Friday at the Coral Gables Art Cinema.