The town of Greenleaf, Indiana, is bland to the bone. It's the colour of sugared almonds and its texture is pure daytime television. The motto of the local school is "Study, Learn, Leave". If the place really existed, you imagine it would recede from you even as you were driving into it. Greenleaf is the setting for the light comedy In and Out, and since the screenwriter Paul Rudnick is such a compulsive in-joker - he's the voice behind the barbed-wire wit of the Libby Gelman-Waxner column in the American magazine Premiere - you imagine that he positively swooned to the news that Frank Oz was going to shoot his screenplay. Here is a director who could make a 3-D movie look flat, now being hired to put the embodiment of all that is dull and embalmed about America on screen. And as the camera patrols the picket fences and crisp square lawns and fleets of yellow schoolbuses, you wait for the movie to draw blood.

The initial signs are promising. Howard Brackett (Kevin Kline) is a popular high school teacher teetering on the brink of marriage. Wandering into the school changing-rooms, Howard is ambushed by his students, who wish to offer their own distinctive brand of congratulations. These semi-naked adolescent jocks form a circle around their teacher and shower him with champagne. The corks pop triumphantly; Howard looks elated, soaked in alcohol and ecstacy. It's a generic gay porn scenario, coincidentally shot in the style of the Lindsay Kemp sequence from Sebastiane. The point is made swiftly and succinctly - the most impenetrable sanctuary of heterosexuality often carries the heaviest cargo of homoeroticism.

It's a nice touch that the Academy Awards should be the direct catalyst for revelations about Howard's sexuality. One of his former pupils, now a hotshot young actor (played by Matt Dillon), decides to take his Oscar acceptance speech as an opportunity to reveal that his inspiration for playing a gay soldier came from Howard. The immediate reason for this contrivance is that In and Out was inspired by Tom Hanks' own speech upon collecting the Best Actor award for Philadelphia, in which he namechecked an ex-teacher. But Rudnick knows that the Oscars ceremony itself is arguably the gay equivalent to the World Series. He makes his characters oblivious to this; every member of every family is huddled around the TV set on Oscar night, complete with notepad and pencil, swapping tips on the Best Documentary category.

Rudnick's brand of comedy is based on the presumption that what a man puts on his bookshelves, or in his drawers, or on his turntable, will reveal his sexuality. This is his main source of humour: references to Howard's interest in interior decorating, or show-tunes, become not so much running jokes as the very backbone of the picture. Most of the film's more ticklish episodes provide variations on the moment in Heathers where a suicide victim was pronounced indisputably gay after a bottle of Perrier was discovered among his personal possessions. Yet Rudnick is trapped in a strange dichotomy, compelled to crack the gags that he loves whilst duty-bound by the agenda of the movie to concede that you can't always judge a book by its cover. The film argues that you shouldn't use props and symbols to define people, but consistently presents its characters through those same easily identifiable props and symbols, whether it's the Barbra Streisand records in Howard's collection or the novelisation of Beaches hidden in a gay man's locker.

In and Out places the inhabitants of Greenleaf beyond the reach of kitsch and camp, and even beyond the 20th century, so that there's no context for their reactions when they discover Howard's secret; they simply progress through various stages of bemusement. Howard's Principal has difficulty saying the word "homosexual", while his pupils puzzle discreetly over the anatomical permutations of gay sex. By the final scene, everyone is engaged in dialogue with their inner homosexual. It's less a slice of gay wish-fulfilment than a Walt Disney version of what gay wish fulfilment would be like - one big family where happiness is synonymous with anonymity. For a jubilant view of harmony, it's depressing stuff.

It isn't that Rudnick is betraying his own sexuality. Heterosexuals don't come off any better. A self-help tape that Howard buys in order to re- affirm his masculinity reminds him that the genuine man avoids rhythm, grace and pleasure at all costs. Men work and drink and get bad backs. And they never dance. "I Will Survive" starts up; Howard's sexuality is to be judged on the degree of his immunity to Gloria Gaynor.

While this scene can be taken as a mild parody of macho conventions, there is a more damning perspective on relationships in general buried in the dialogue given to Howard's fiance Emily (Joan Cusack). Discovering that the man of her dreams may not be quite what he seems, she complains: "I based my whole self-esteem on the fact that you were willing to marry me." The imposing weight of marriage is also present in the shape of Howard's bullying mother (Debbie Reynolds), while its connotations of doom and claustrophobia are expressed in the shot of a wedding cake displayed in the back of a station wagon like a coffin in a hearse, and in the scene where Emily flees her own wedding, gathering the tidal-wave folds of her dress into the driver's seat so that what seemed magnificent and elegant is now swollen in her lap like an air-bag.