In "A Midsummer Night's Sex Comedy," Woody Allen seems to be acknowledging his inspirations all too bluntly.

Having evoked Shakespeare and Ingmar Bergman's exquisite boudoir farce "Smiles of a Summer Night" right off the bat, Allen has his work cut out for him as he tries to fabricate a romantic comedy of comparable charm and distinction. The intention is undeniably appealing, especially after a rude brushoff like "Stardust Memories," but Allen isn't quite up to the challenge of a playful, enchanting entertainment.

"Sex Comedy" has possibilities. Unfortunately, Allen fails to sustain the premise--flirtation among three fickle couples gathered at a secluded summerhouse in upstate New York shortly after the turn of the century--much beyond the introductory stages.

Allen and Mary Steenburgen play the hosts--an amorous, whimsical type named Andrew (his endearing self-description is "crackpot inventor") and his sexually timid wife Adrian. They are joined by an impending marital mismatch--Jose Ferrer as Adrian's cousin Leopold, a pompous philosophy professor, and Mia Farrow as his fiance' Ariel, a notorious beauty and heartbreaker who eluded Andrew years earlier. The last couple is a pair of unattached hedonists--Tony Roberts as Andrew's best pal Maxwell, a doctor, and Julie Hagerty as his date Dulcy, an obliging nurse. Assembled under one roof in a lyrical, moonstruck summer setting, this trio of dissatisfied or tenuous partners is meant to succumb to the temptation of changing partners before disillusion catches up with them and restores order to a tangle of affections.

Ariel is supposed to be the catalyst, a woman so alluring that she immediately makes all three men rivals for her favors. When she enters, it's love at first sight for Maxwell and rekindled desire for Andrew. Although provocative in theory, Ariel proves a washout in practice. Allen has left the character a cipher, and Mia Farrow isn't magnetic enough to suggest qualities that remain undocumented in the writing itself. In fact, she's rather less attractive than the other actresses, whose glowing, rounded facial contours lend themselves more persuasively to voluptuous suggestion than her fragility. Moreover, she's undermined by a peculiarly creepy overtone in the dialogue. Farrow not only seems to be reading lines intended for Diane Keaton; before long she begins to sound like Diane Keaton. If you close your eyes, you'd swear that Ariel was being played by Diane Keaton. Far from emerging as the sexual troublemaker who motivates "Sex Comedy," the role of Ariel tends to throw you out of context by being so obviously and inappropriately haunted by Allen's erstwhile leading lady.

When the basic plot mechanism misfires, other annoying defects begin looming larger than they might have. For example, you're aware of how crudely the other women's roles are sketched, with Steenburgen more or less relegated to molesting Allen on the kitchen stove (an effective sight gag, nevertheless) and Hagerty to sounding like a promiscuous nitwit. The elaborate early buildup of Ferrer's character as a smug snob headed for an instructive comeuppance (similar to the Gunnar Bjornstrand character in "Smiles of a Summer Night") also seems overemphasized when nothing important comes of his self-deception and hypocrisy.

In addition, Allen has the characters conversing in an overexplicit, post-analytic style that is instantly recognizable as his comic lingo but sounds ill-suited to the period, ostensibly 1906. There's also something gratuitously funny about the suggestion that we must be encountering historical ancestors of Allen's modern, urban American neurotics. However, as the movie falters, this anachronistic aspect seems to aggravate the problems. Everything not only goes wrong but also sounds wrong. When Allen and Roberts get into an argument, the rhythms and colloquialisms seem indistinguishable from the dialogue they've exchanged in previous movies.

Allen mixed a much livelier erotic cocktail several years ago when he wrote "What's New, Pussycat?," also an exercise in traditional bedroom farce. The crucial problem with "Sex Comedy" is that one detects no persuasive sexual chemistry in any of the alleged, three-cornered mating games. It's impossible to believe that anyone's susceptibilities are deeply stirred or anyone's feelings likely to be hurt. Allen can't establish the basic sense of attraction and the emotional gravity that underscores the frivolity of the romantic hide-and-seek.

There are pleasant, amusing aspects to the show. The fanfare of Mendelssohn's Wedding March gets the movie off to a rousing start, as Prokofiev's "Lt. Kije" theme did for "Love and Death." Gordon Willis' photography sustains a warm, inviting summer glow. A few of the gags are wonderfully farfetched, especially the ones associated with Andrew's inventions, and the role of Andrew also seems perfect for Allen in the early going--crackpot inventor is an outmoded profession ideally suited to his temperament.

Unfortunately, Allen hasn't been able to create a farce that works with the giddy proficiency of Andrew's pedal-powered flying machine and spirit-invoking magic lantern.

"A Midsummer Night's Sex Comedy" promises to take off every so often, but the material proves too slight for buoyant fancy.