The Sounds of New Hampshire nearly drowned out the Sounds of Music at the White House last night.

Waiting on the North Portico for Austria's president, Rudolf Kirchschlaeger, President Reagan was asked by a reporter about the primary.

"Early returns from New Hampshire show you are way ahead," said the reporter. "Do you think it's going to hold?"

The president burst into laughter. And Nancy Reagan laughed louder.

"It's that fellow I'm running against," said the president.

Later, when it was clear that Sen. Gary Hart had bested the Democratic field, Reagan grinned and said, "Well, that's going to stir things up." But when asked if he thought Hart would gain momentum from the victory, the president said, "There's still Super Tuesday."

Vice President Bush said he was surprised and "if anybody tells you they weren't, don't believe them. It was a lot different than we were led to believe and it makes for a very interesting race on that side, not an early lock-up. I like it."

When Nancy Reagan heard of the upset, her eyes widened and her comment was parsimonious. "My!" she said.

During dinner, Frank J. Fahrenkopf Jr., chairman of the Republican National Committee, got word of the Democratic outcome but decided not to tell Reagan how well the write-in effort on behalf of the president was faring. That didn't seem to stop Reagan, however. He went around telling some of the guests: "At least I got 10 percent of the vote." (Reports last night indicated Reagan had garnered about 3,600 votes on the Democratic ballot while winning handily in the GOP primary.)

Lyn Nofziger, Reagan's political consultant, said of the New Hampshire results: "All of a sudden we have a race. It'll keep all the other candidates in."

And Sen. Mack Mattingly (R-Ga.) said Hart's first-place finish had turned the Democratic campaign into "a horse race."

For the Austrians, the evening wasn't only a study in the American electoral process but a historic "first." Kirchschlaeger's visit was the first for an Austrian head of state since relations were established about 150 years ago.

In his toast, Reagan said the United States wants "genuine, persistent negotiations with the Soviet Union. Rest assured that we will continue this policy, in the hope that it will yield the results for which the world yearns."

Kirchschlaeger, who responded in English, said neutral Austria promotes stability and security among its neighbors and stands as "a clear voice in support of human rights" and "the rule of law."

The Austrian drew a laugh when he invited the Reagans to come to Austria "officially or unofficially, whichever is more convenient to you."

The black-tie crowd was an amalgam of politics, commerce and show business. Larry Hagman of "Dallas" fame gave the president a little gift for "getting the economy back in shape." Taking shredded U.S. currency, friends of Hagman had painstakingly fitted together minute greenback slivers to reproduce a $10 bill.

"It may take a little longer that way," said Hagman, handing Reagan the bill encased in plastic.

Other guests included Phyllis Diller, looking glamorous in a filmy black dress and a diamond necklace. Asked if her escort, Howard Rose, had given her the necklace, she replied, "No, I worked for it." Also there were actor Maximilian Schell, resplendent in a black velvet evening jacket; Redskins coach Joe Gibbs, broadcast executive Ted Turner and 1976 Olympic Gold Medal skater Dorothy Hamill.

They all dined on filet of trout, supreme of capon and a dessert of orange sorbet. Three California wines were served. After coffee in the State Rooms, everybody gathered in the East Room to hear Mel Torme sing and Peter Nero play Gershwin on the piano.

Nancy Reagan wore a glittering black dress by Bill Blass and large red-and-black earrings. Herma Kirchschlaeger had on an equally shimmering gray dress with pearl earrings.

Octogenarian Baroness Maria von Trapp, whose escape from Austria before the outbreak of World War II inspired the play and film "The Sound of Music," came in a severe black dress that recalled her convent days. Her grandson, George, escorted her.

"I'm just plain happy," the baroness said of her first White House dinner. Of the Torme-Nero sounds of music, she was less enthusiastic. "May I not say what I thought of it?" she said.

In his toast, Reagan called the baroness "one of the best loved of all Austrian Americans," who has come to stand for "Austrian integrity, wit and charm."

The White House was full of spring flowers and fruit trees in bloom, but edelweiss, the flower "The Sound of Music" made famous, bloomed only in Reagan's remarks: "Before the song ends, the lyrics become a prayer for Austria itself. It is a prayer Americans join in: 'Blossom of snow may you bloom and grow, and bless your homeland for ever.' "

Earlier in the day, music seemed to swirl through the luncheon Secretary of State George Shultz gave for the Austrians. And Austria's ambassador here found out that the tune "Edelweiss" is just as sacred to Americans as apple pie and motherhood.

"There are 200 million Americans who know it's the Austrian national anthem," U.S. Trade Representative William E. Brock III told Ambassador Thomas Klestil at the luncheon.

"And whether you like it or not," Brock teasingly said of the Rodgers and Hammerstein tune that became known to millions through "The Sound of Music," "it is definitely yours."

Klestil told about going to a Texas charity function whose theme for the evening was Austria. At one point he said he was invited to join everyone in singing "a beautiful Austrian song, 'Edelweiss.' "

"I didn't know the words," Klestil confessed. "I said, 'It is not an Austrian song, it is a movie song written in Hollywood.' When I said I didn't know the words, they were all shocked and they looked at me as if I were not a patriot."

Just then, Muffet Brock, also registering shock, interrupted to ask: "You mean it isn't the Austrian national anthem?"

Klestil shook his head, gave what some would have sworn was a polite gulp, looked across the table at Margit Fischer, wife of the Austrian minister of science and research, and began to sing "Edelweiss, Edelweiss . . ."

"You see," said Klestil watching Fischer's expressionless face, "here's the wife of an Austrian government official and she doesn't know it either."

Guests at last night's state dinner:

President Rudolf Kirchschlaeger of Austria and Herma Kirchschlaeger

Erwin Lanc, minister of foreign affairs

Heinz Fischer, minister for science and research, and Margit Fischer

Ferdinand Lacina, minister of state in the federal chancellory, and Monika Lacina

Thomas Klestil, Austrian ambassador to the United States, and Edith Klestil

Wolfgang Loibl, director general of the office of the president

Kurt Skalnik, director general, head of the president's press and information service

Friedrich Bauer, ambassador, political director, ministry for foreign affairs

Christoph Cornaro, ambassador, chief of protocol, ministry for foreign affairs

Franz Irbinger, minister, embassy of Austria

Richard E. Berendzen, president, The American University, and Gail Berendzen

Pat Boone, singer, and Shirley Boone

Michael Botwinick, director, Corcoran Gallery of Art, and Harriet Botwinick

Sen. Bill Bradley (D-N.J.) and Ernestine Bradley

Ruth Buchanan, Washington

Richard R. Burt, assistant secretary of state for European affairs

Vice President and Barbara Bush

William N. and Buffy Cafritz, Bethesda

Dr. William G. Cahan, Memorial Sloan-Kettering Cancer Center, and Grace Mirabella, editor, Vogue magazine

Lt. Gov. Robert A. Cashell, of Nevada, and Nancy Cashell

Linda Castillo

Rep. William Chappell (D-Fla.) and Billie Larson

Maude Chasen, Chasen's Restaurant

Charles H. Clark, Smithsonian board member, and Jeanine Clark

William P. Clark, secretary of the Interior, and Joan Clark

Rep. James A. Courter (R-N.J.) and Carmen Courter

Carolyn Deaver

Dom DeLuise, comedian, and Carol DeLuise

Phyllis Diller and Howard Rose

William C. Douce, chairman and chief executive officer, Phillips Petroleum Co., and Willene Douce

Frank J. Fahrenkopf Jr., Republican National Committee chairman, and Mary Fahrenkopf

Thomas F. Faught, president and chief executive officer , Dravo Corp., and Lynda Faught

Joe Gibbs, Washington Redskins coach, and Pat Gibbs

Fred and Helen Gottfurcht, Los Angeles

Adm. James S. Gracey, U. S. Coast Guard commandant, and Randy Gracey

Larry Hagman, actor, and Maj Hagman

James Haslam, president, Pilot Oil Corp., and Natalie Haslam

Dorothy Hamill, Olympic Gold Medal winner, ice skating, Innsbruck, Austria, 1976, and Theodore J. Forstmann, Forstmann, Little and Co.

Donald Hodel, secretary of Energy, and Barbara Hodel

Ann Compton, ABC White House correspondent, and Dr. William Hughes

John P. Humes, former ambassador to Austria, and Jean Humes

Sen. Robert W. Kasten Jr. (R-Wis.)

Della Koenig, Mexico City

Stanley Kreitman, president, United States Banknote Corp.

Lewis W. Lehr, chairman and chief executive officer, 3M Co., and Doris Lehr

Gordon C. Luce, chairman and chief executive officer, Great American Federal Savings Bank, and Karon Luce

Paul Manheim, Lehman Brothers, and Simone Manheim

J. Willard Marriott Jr., president, Marriott Corp., and Donna Marriott

Sen. Mack Mattingly (R-Ga.) and Carolyn Mattingly

Robert C. McFarlane, national security adviser, and Jonda McFarlane

Edwin Meese III, counselor to the president, and Ursula Meese

Patricia Neal

Peter Nero, performer, and Peggy Nero

Lyn Nofziger, former assistant to the president, and Bonnie Nofziger

Verne Orr, secretary of the Air Force, and Joan Orr

Thomas G. Pownall, president and CEO, Martin Marietta Corp., and Marilyn Pownall

Retired Army brigadier general George B. Price

Nancy Clark Reynolds, Wexler, Reynolds, Harrison and Schule, Inc.

Selwa W. Roosevelt, chief of protocol, and Archibald B. Roosevelt Jr.

Maximilian Schell

George P. Shultz, secretary of State, and Helena Shultz

Arthur Spitzer, Beverly Hills

Mel Torme, performer, and Alice Severson

R.E. (Ted) Turner, chairman of the board, Turner Broadcasting Systems Inc., and Jane Turner

Thomas Vail, publisher and editor, Plain Dealer Publishing Co., and Iris Vail

Helene A. von Damm, U.S. ambassador to Austria, and Byron Leeds

Baroness Maria von Trapp, Stowe, Vt., and George von Trapp

Kurt Waldheim, former secretary general of the United Nations, and Elisabeth Waldheim

George White, general manager of the Beverly Wilshire Hotel, and Rosamind White

Howard Wilkins, chairman, Maverick Restaurant Corp.