There were so many idols, heroes and distinguished Romans at the White House last night that at times it was hard to tell exactly who was the main attraction.

Officially, the spotlight was on Italian President Sandro Pertini, making his first official visit at the age of 85. But throughout the evening Pertini shared the limelight with an all-star guest list: Gen. James Dozier; Frank Sinatra; Perry Como; Joe Montana, star quarterback of the Super Bowl champion San Francisco Forty-Niners; Tommy Lasorda, manager of the world champion Los Angeles Dodgers, and Clare Boothe Luce, author and former ambassador to Italy.

Pertini's eight-day U.S. visit is aimed at reaffirming the already close relations between the United States and Italy.

Earlier in the day, President Reagan thanked Pertini for helping in the rescue of General Dozier, who had been kidnaped in December by Red Brigades terrorists in Italy. Dozier flew to Washington just for last night's dinner.

And the general's appearance at the White House coincided with the conviction in Verona of 17 of Dozier's captors.

Dozier was also mentioned last night as the two leaders toasted each other. "We're not here to beg aid," Pertini said, "but to reaffirm our stubborn will to oppose terrorism with all our strength." Recalling the anxiousness with which his people awaited word of Dozier's fate, Pertini commended the general's courage in facing up to his captors.

As part of his 13-page toast, the Italian leader also quoted from Franklin D. Roosevelt discussing liberty: "We have come to a clear realization of the fact that true individual freedom cannot exist without economic security and independence. 'Necessitous men are not free men.' "

President Reagan, in his toast, told how Pertini said shortly after his election that "if someone offered me, who has always been a socialist, the most radical social reform at the expense of freedom, I would refuse because freedom must never be bartered away."

In a lighter vein, Reagan joked about Pertini's rise to the presidency relatively late in life, an observation often made regarding Reagan. "You might consider making the theater a second career," said Reagan. "For an energetic man like yourself there are interesting opportunities. I know it works one way--it might work in reverse."

Dozier, who was the first guest to arrive at the dinner, said he hadn't heard about the convictions. His wife, Judith, however, walked back over to reporters to ask exactly what the sentences were. When told that they ranged from 26 months to 27 years, she said "We expected that. They've got a lot of other things they are going to try those people on."

Frank Sinatra and Perry Como, who were the entertainment for the evening, arrived together. Barbara Sinatra was draped in a striking white, red and green Michael Volbrecht dress and cape. Her matching emerald and diamond necklace, ring and earrings glistened. "These are my Italian colors," she said.

Sinatra and Como, preforming in the East Room in a low-key cabaret style, crooned all their best-known hits, which spanned four decades. Como sang "It's Impossible," and Sinatra did "I've Got You Under My Skin."

Following the performance, Pertini went on the stage and told Sinatra and Como in Italian that "I hope you will come to Italy when Mr. Reagan comes in June. You will be my guests."

President Reagan cracked "President Pertini has just proclaimed you illegal aliens and he's repatriating you."

Then Sinatra and Como were under siege by autographers seekers who lined up by the two pianos. "I just have to have an autograph," said Joe Montana, handing Sinatra a pen and program.

"Oh, Joe, are you kidding," said Sinatra, signing away.

It was the second time Sinatra had performed at the White House. The previous time was when President Nixon also entertained an Italian head of state.

"I was here when Eisenhower was president but I never performed before," said the 69-year-old Como, who seemed to be having the time of his life.

Earlier in the day, White House staff and press gathered in the East Room to hear Sinatra and Como and their Italian backup band practice. "This is the Italian hour," Sinatra joked to the crowd.

Nancy Reagan surprised the singers by showing up for the end of their rehearsal. The first lady danced into the room as the band started playing Rodgers and Hart's "The Lady Is a Tramp." Sinatra sang the song, substituting "champ" for tramp.

Joe Montana, who has the reputation of being cool in combat on the football field, arrived at the White House wringing his hands last night.

"Nervous," he responded when asked how he felt. "I told my dad I was so nervous that he could take my place."

Asked whether he and his wife, Cass, were Republicans, she quipped, "We are tonight." Dodgers manager Lasorda arrived with his high school pal from Norristown, Pa., Health and Human Services Secretary Richard Schweiker.

"He was on the tennis team and I was on the baseball team," said Lasorda, draping his arm around his friend.

"He did better than I did," said Schweiker. "He stuck with it."

"But he's got a pretty good job too," said Lasorda.

"He's a winner," shot back Schweiker. The two men filed into the dinner arm and arm.

Dinner last night consisted of shrimp mousse, tenderloin of veal, asparagus and strawberries. For the first time, the president and first lady's tables were next to each other in the state dining room. Normally, they are across the room from each other.

When the party was over, guests trickled out into the Washington rain. Standing on the North Portico, where some guests were lined up for their limousines, Como handed John Volpe, former ambassador to Italy, $5.

"Perry bet me that he was older than I am," said Volpe. But I was 73 last December. So he gave me the $5.

"On the front steps of the White House, no less."

Guests at last night's White House dinner:

Emilio Colombo, minister of foreign affairs

Antonio Maccanico, secretary general of the presidency of the republic

Rinaldo Petrignani, ambassador of Italy to the United States, and Anne Merete Petrignani

Ambassador Bruno Bottai, director general for political affairs, Ministry of Foreign Affairs

Ambassador Carlo Calenda, diplomatic counselor to the president

Gen. Mario Parisio, military counselor to the president of the republic

Gen. Arnaldo Ferrara, counselor to the president of the republic for democratic order and national security

Minister-Plenipotentiary Marcello Guidi, chief of diplomatic protocol of the Republic of Italy

Minister-Plenipotentiary Giacomo Attolico, deputy director general for economic affairs

Minister-Plenipotentiary Raniero Vanni d'Archirafi, director of the cabinet of the minister of foreign affairs

Minister-Plenipotentiary Sergio Grimaldi, Department of Emigration and Social Affairs

Minister-Plenipotentiary Michelangelo Jacobucci, spokesman and press adviser to the president of the republic

Rep. Frank Annunzio (D-Ill.) and Angeline Annunzio

Constance D. Armitage, associate professor of art history, Wofford College

Susan Baker

Betsy Bloomingdale, Los Angeles

Gioia Braga and George A. Braga

L. Keith Bulen, Indianapolis

Elisabeth Bumiller, The Washington Post

Vice President George Bush and Barbara Bush

Aldo Caira, president, Order of the Sons of Italy in America, and Loretta Caira

Rep. Dick Cheney (R-Wyo.) and Lynne Cheney

William P. Clark, assistant to the president for national security affairs, and Joan Clark

William P. Clark Sr., Oxnard, Calif., and Mrs. Clark

John Bennett Coleman and Virginia Regan, New York, N.Y.

Perry Como, Great Neck, N.Y.

Mr. & Mrs. Ralph Cormany

Count & Countess Rudi Crespi, New York, N.Y

Sen. Alfonse M. D'Amato (R-N.Y.)

Michael K. Deaver, deputy chief of staff and assistant to the president, and Carolyn Deaver

David Del Tredici

Ralph Destino, president, Cartier Inc., and Joan Schnitzer

Sen. Pete V. Domenici (R-N.M.) and Mrs. Nancy Domenici

Gen. James L. Dozier and Judith Dozier

Mr. and Mrs. Arthur Fletcher, Washington, D.C.

Alan Green, chairman, Federal Maritime Commission, and Mrs. Green

Frederick W. Guardabassi and Marilyn Guardabassi, Fort Lauderdale, Fla.

Philip Guarino, Republican National Committee, and Sarah Guarino

Secretary of State Alexander M. Haig and Patricia Haig

Lee Hanley Jr. and Alice Hanley, Greenwich, Conn.

Adm. Thomas B. Hayward, U.S.N., chief of naval operations, and Mrs. Hayward

Sen. John Heinz (R-Pa.) and Mrs. Teresa Heinz

H. Allen Holmes, acting assistant secretary of state for European affairs

John E. Jacob, president, National Urban League, and Barbara Jacob

Tom Johnson, publisher, Los Angeles Times, and Edwina Johnson

Tommy Lasorda, manager, Los Angeles Dodgers, and Mrs. Lasorda

Mr. and Mrs. Frederick Lennon, Solon, Ohio

Clare Boothe Luce, former ambassador to Italy

Justice Thurgood Marshall and Cecilia Marshall

Mr. and Mrs. Joseph Maselli, Italian American Federation

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

Joe Montana, San Francisco Forty-Niners quarterback, and Cass Montana

Thomas Nassif, acting chief of protocol, and Zinetta Nassif

Maxwell M. Rabb, U.S. ambassador to Italy, and Ruth Rabb

Mrs. Diago Redo, Tucson, Ariz.

Rep. Peter W. Rodino Jr. (D-N.J.)

Peter W. Rodino III

Raymond Rossi, chairman, Martini Rossi Inc., and Mrs. Rossi

Pat and Clara Scarpelli, Los Angeles, Calif.

Richard S. Schweiker, secretary of health and human services, and Claire Schweiker

Francis Albert Sinatra, Hollywood, Calif., and Barbara Sinatra

Ray Stark, chairman of the board, Rastar Films Inc., and Mrs. Stark

Frank Stella, president, National Italian-American Foundation, and Mrs. Stella

Thomas and Chardee Trainer, Beverly Hills, Calif.

Dorothy Uhlemann, Sinatra Enterprises, Hollywood, Calif.

John A. Volpe, former ambassador to Italy, and Jennie Volpe

Sheila Weidenfeld Edward L. Weidenfeld

Steve Weisman, The New York Times

William A. Wilson, personal representative of the president to the Vatican, and Elizabeth Wilson

Oscar S. and Lynn Wyatt, Houston, Tex.