On one level, Woody Allen's "The Purple Rose of Cairo" is a wonderfully inventive, blithely entertaining little movie -- it's just plain fun. But inside this movie works the most horrifically nihilistic imagination active in film today. At its heart, "The Purple Rose of Cairo" isn't art -- it's anti-art, a neutron star of a movie, a pocketful of nothingness.

Set in the Depression, the movie follows Cecilia (Mia Farrow), a downtrodden naive who all but lives at her local cinema, the Jewel, where she can forget her bullying, besotted husband (Danny Aiello) and the frantic boredom of waiting on tables. One day, the theater books "The Purple Rose of Cairo," the kind of snappy white-tie-and-tails '30s comedy in which everyone's always traipsing off to the Copacabana. Cecilia sits through show after show.

In the masterfully managed sequence that follows, Allen shows us the same few scenes from the movie at the Jewel, as Cecilia watches raptly in the audience. Just when the dialogue becomes familiar, Allen picks up the pace -- the scenes tumble upon one another in a whirl. By this point you know the movie by heart, so when the slightest thing goes awry, you notice it. Somebody muffs a line -- what's going on here? Then a character comes to the front of the screen and starts addressing the audience. Then the character steps out of the screen.

His name is Tom Baxter (Jeff Daniels), a pith-helmeted explorer adventuring in New York's high society; he's noticed Cecilia in the audience, and fallen in love with her. On the screen, the martini-swilling swells can't go to the Copa without him, so they sit around the set, getting cranky with the audience and each other. Baxter, meanwhile, flunks real life -- his stage money doesn't work, and when he offers a Jack Armstrong handshake to Cecilia's husband, he's rewarded with a knee to the groin. The movie's producer, foreseeing lawsuits, hustles in from the Coast trailing the star, Gil Shepherd (Daniels again), who created the unruly character. Soon enough, Gil is courting Cecilia, too.

Allen has an incomparable flair for parody. The movie-within-a-movie is riotously funny, and cinematographer Gordon Willis and production designer Stuart Wurtzel have given it a period look that is letter-perfect. Allen has distilled the movie-within-a-movie so that it becomes every '30s comedy you ever saw. And it's studded with subtly witty performers who walk into the acting style of the period without ever seeming studied. (They include John Wood, Deborah Rush, Van Johnson, Zoe Caldwell, Karen Akers and a priceless Edward Herrmann.)

What's remarkable about "The Purple Rose of Cairo" is not simply the formal perfection of the conceit (which was as far as "Zelig" went), but the way Allen is able to weave it into the narrative. The movie never feels gimmicky; the pace of the editing is so assured that the surreal elements enter the story as effortlessly as a practiced relay racer passes his baton. But that seamlessness is the first tip-off that something more is going on here.

In the story, Cecilia must choose between the real world and the fantasy world on the screen; but "The Purple Rose of Cairo" is itself a movie, Cecilia a character, and Allen makes sure you see that -- what purports to be reality in "The Purple Rose of Cairo" is clearly a movie reality. The tones of the two movies are different, but they're both old-fashioned movies: in the Jewel, a black-and-white romp; in our theater, a film that (though in color) has the kind of hokey, sentimental movie magic you don't see anymore.

The themes and devices themselves are avowedly artificial, many borrowed from a number of literary and cinematic sources. The plot unfolds in routine, predictable fashion. Everything is signaled. Cecilia is the kind of sweetheart who always gets a happy ending, and she has a jolly musical leitmotif in the score. But she doesn't get the ending we expect. Allen is breaking the contract he's made with us, shattering the movie reality we've bought into. He's slapping us in the face.

But the slap wakes us up -- it's a Brechtian way of making us aware that we were being manipulated before.

Only now do we realize that all along what we thought was real was as much of a sound stage as the set of the movie-within-the-movie. Willis' velvet, painterly colors have given it all a stylized look. Everything in the performances is similarly stylized. Aiello plays the husband as a proletarian caricature, with a big, theatrical style. Farrow and Daniels are playing characters out of other Woody Allen movies, except the gender roles are reversed. Farrow is the Allen who is a lovable, pitiable nebbish, and she even has his cadences and inflections down, the flummoxed, teasing way words spill from his mouth. As Shepherd, gazing into the sky, hands on hips, genially inarticulate, Daniels is a dead ringer for Diane Keaton's Annie Hall.

The mirrors don't stop there, though. Allen's skill makes you lose yourself in the movie, so when it's revealed as a fraud, all of us who have entered it are revealed to be frauds as well. "The Purple Rose of Cairo" has a movie-within-a-movie, but it's also a movie within the movie of our own lives -- when Allen pulls the rug out, he makes you feel as illusory as the characters you've been watching. "You don't understand what it's like to be nothing," says one of the characters on the screen, begging the theater owner not to turn off the projector. "To disappear, to be annihilated . . . "

For Allen, there is no reality -- we are only our appearances, we only seem to be, and that discovery is filled with dread. This is the bleakest form of nihilism, turned not only against the universe, but against the self. Allen isn't merely criticizing escapism in the fantasy life of the screen, where your corns don't hurt because Fred Astaire sweeps you off your feet; he's rejecting the idea of any kind of transcendence. Why anyone would want to make a movie saying this is another question, but at this stage, Allen doesn't seem to know any other way. This, he says, is life. And this is despair. The Purple Rose of Cairo, opening today at area theaters, is rated PG.