"The Deer Hunter," a grueling epic about the effect of the Vietnam war on three American friends, won five Oscars, including Best Picture of the Year, at the 51st annual Academy Awards, televised from Los Angeles last night.

The only film to come close to rivaling "Hunter" was another movie with a Vietnam, theme, "Coming Home," about an affair between a wounded veteran and the wife of a Marine officer, which won three Oscars, including those for best actor, Jon Voight, and best actress Jane Fonda.

"Deer Hunter" was cited for best direction (by newcomer Michael Cimino), best editing, best sound, and best performance by a supporting actor, Christopher Walken.

"I love you madly," director Cimino told the crowd as he clutched his Best Picture Oscar. When he won for best director, he said that "most of all, I embrace Robert DeNiro," a loser in the best actor category.

"Heaven Can Wait," the hit comedy remake of 1940's "He Comes Mr. Jordan," had tied "Deer Hunter" for nominations with nine, but won only one, for art direction. Producer, co-director, coauthor and star Warren Beatty did, however, get to hear his sister Shirley Maclaine declare from the podium, "How proud I am of my little brother!"

In addition to the performances of Voight and Fonda, "Coming Home" was cited for its original screenplay. The Oscar for best screenplay based on material from another medium went to the drug bust expose, "Mid-night Express."

In a year of nominees generally considered lackluster by both the motion picture industry and the public, it was the presentation of the Best Picture award rather than the award itself that was the high point of the evening, John Wayne, 71, made his first public appearance since undergoing surgery for stomach cancer three months ago, to hand out the prize.

"Ladies and gentlemen, Mr. John Wayne," said host Johnny Carson and Wayne walked nimbly down a long, winding staircase while a 100 piece orchestra played "The High and the Mighty" and the crowd rose in an ovation.

"That's about the only medicine a fella'd ever really need," Wayne told the crowd after the applause. "I'm mighty pleased I can amble down here tonight."

Wayne said he and the Oscar came to Hollywood the same year, 1928

"We're both a little weather beaten but still here, and plan to be around a whole lot longer," he said to another roar of approval from the audience.

The climax came very late in the evening, however, since the awards program dragged for 45 minutes beyond its scheduled 2 1/2-hour length. The gaunt but game Wayne, whose own views are probably not consistent with the New Hollywooders who made "Deer Hunter" and Coming Home, and who himself made the pro-Vietnam war film "The Green Berets" in 1968, made no reference to politics in handing out the top award or listing the Best Picture nominees.

Jane Fonda, named best actress for her role as the unfaithful wife of a Vietnam veteran in "Coming Home," accompanied part of her speech with sign language because, she said, the film had given her a new awareness of "the problems of the handicapped."

Fonda, who thanked nearly everyone in the world-including husband Tom Hayden and her two children-said in a very lenghty speech, "I'm so proud of "Coming Home," and I want many people to see the picture."

Jon Voight, who won the best actor Oscar for playing Fonda's paraplegic lover in the film, hugged Bruce Dern, who lost the supporting actor Oscar for the film, before making his remarks. "I would like to thank everyone, but I select to thank a few," he said, and then he named several people, including "Jane whose great dignity as a human being is very moving to me." At the point he got teary.

Johnny Carson, for the first time in his career, was host of the program, which he described in his opening monologue as "two hours of sparkling entertainment spread out over a four hour show." Carson, fiddling incessantly with his shirt cuffs, also made mocking references to the political preoccupations of some nominated actors, but in fact the Oscar ceremonies were being picketed at that moment by Vietnam veterans opposed to the portrayal of the war in "The Deer Hunter."

The demonstrators carried placards outside the Los Angeles Music Center, and denounced the film, which depicts both North and South Vietnamese as brutal and corrupt.

The Oscar for special effects, announced in advance, went to the team of technicians who made the title character of "Superman" fly and was presented by comedian Steve Martin, who walked out on stage with an arrow through his invisible head - an illusion created by a TV special effect.

To make up somewhat for a dearth of sentimental choices among actual nominees, the academy came up with such sure-fire emotional moments as an honorary award to Lord Laurence Olivier, who just completed his 60th film at the age of 72. Cary Grant, who introduced Olivier has graced ours" and called him "the ultimate actor."

After a prolonged standing ovation, Olivier, whose illnesses have forced his retirement from the stage but not the screen, thanked the crowd for "this great gift which lends me such glorious occasion" and praised "the prodigal, pure human kindness" of the gesture, Olivier said the award filled him with "elation" and "euphoria."

Maggie Smith was a surprise winner for best supproting actress in the Neil Simon comedy "California Suite," in which she played, ironically, an Oscar losing actress. "I really can't believe it," she told the crowd, and among those thanked was Michael Caine, who played her homosexual husband in the film.

Christopher Walken, named best supporting actor for his role in "The Deer Hunter," played the part of a young factory worker who fought in the Viernam war and went mad. Alken thanked the usual list of thankees.

Even for an evening drastically short on lighthearted moments, the Oscar for best screenplays, original and adapted, brought out heavy doses of solemnity from the winners. Nancy Dowd, one of the writers of "Coming Home," which won for best original screenplay, told the audience she wrote the first script in 1973 when the Vietnam war was still on.

"I was inspired by the Vietnam veterans and the women who loved them," she said. "Now, six years later, I have an Oscar, but for the people for whom I wrote, the war still goes on." The film deals in part with the plight of the disabled veterans.

Oliver Stone, who adapted "Midnight Express" from the book about an American youth incarcerated in a Turkish prison for a drug offense, accepted his best screenplay Oscar "for all the men and women all over the world who are in prison tonight"-no less.

The Oscar for Best Foreign Film went to Betrand Blier's ribald comedy about a draft menage a trois, "Get Out Your Handerchiefs." Blier apologized for his English as he told the audience. "Sank you, for all zee American fans of our film."

Music awards went to "The Buddy Holly Story"-for the best adaptation of music already written-and, for the best original score, the Academy members bypassed such established musical names as John Williams ("Superman") and Jerry Goldsmith ("The Boys from Brazil") to give the prize to Giorgio Moroder for "Midnight Express." Moroder said it was his first film score. The soundtrack album and the movie were produced and promoted by the same company-Casablanca Record and Filmworks.

For the first time in Oscar telecast history, all five nominated songs were sung on the show by the performers who introduced them in the films themselves, Kris Kristofferson teamed with Hollywood veteran Ruby Keeler to present the Oscar for best nominated song to Paul Jabara for the disco hit "Last Dance," sung by disco star Donna Summer in the disco movie "Thank God It's Friday."

"I want to thank you all for coming to my bar mitzvah," said Jabara, who once appeared in "Hair" on Broadway. But the larger ovation-a standing one, in fact-went to Keeler, whose live appearance was preceded by a film clip of her dancing on top of a taxi cab in the 1933 musical classic "42nd Street."

The Oscar for best documentary feature went to a film made for television-"Sacred Straight!," the hard-hitting and tough-talking film about the Lifers' Program at Rahway State Prison, where juvenile offenders are subjected to scare tactics designed to discourage their criminal tendencies. Arnold Shapiro, the producer and director of the film, thanked among others, Gene Autrey, a part owner of Golden West Broadcasters, which financed the film.

It was first shown on KLTA-TV in Los Angeles and later syndicated to more than 60 stations throughout the country.

"The Flight of the Gossamer Condor" was named best documentary short subject, "Teenage Father" was chosen best live-action short film and "Special Delivery," produced by the National Film Board of Canada, the best live-action short film.

The first award presented was an honorary one, voted by the board of governors of the academy, to movie animation veteran Walter Lantz, the 79-year-old pioneer who is best known for creating the character of Woody Woodpecker. The bird himself appeared on stage through superimposed animation and hailed Lantz as a man "who's been drawing me, and a very nice paycheck, too, for 38 years."

antz accepted the award as "a tribute to the entire cartoon industry." The trophy was presented by TV star Robin Williams-Mork of ABC's Mork and Mindy."

As usual, the ceremony was televised live from the Dorothy Chandler Pavilion of the Los Angeles Music Center-not actually in Hollywood, as it happens. The awards are voted by the 3,500 members of the Academy of Motion Picture Arts and Sciences. CAPTION: Picture 1, Jane Fonda clutches the Oscar she won for best actress for her role in "Coming Home." AP; Picture 2, no caption; Picture 3, Maggie Smith accepts best supporting actress Oscar; AP photo