Mary Martin did a discreet little samba when nobody was looking. Dulce Figueiredo, the wife of Brazil's president, clapped in time to the music. And Debbie Reynolds called out to the president to sing.

It all happened last night at President and Mrs. Reagan's official dinner for Brazilian President Joao Figueiredo, where the beat was Latin in more ways than musically.

After the dinner a somber President Reagan reacted with shocked concern when he learned that a man dressed as a priest had been apprehended running with a knife toward Pope John Paul II during the pope's visit to Portugal yesterday.

"I just heard about it--all of those who suggested I'm getting overalarmed over a second attempt," the president started to tell reporters, apparently referring to himself, but didn't finish his thought.

Later, trying to clarify his statement, he said, "Maybe levity was out of place with regard to the pope." Then he asked reporters, "Are you talking about the remarks I made about second attempts? No, I was kind of teasing about all the fuss that arose among you as to whether there had been an attempt or not. You remember when the Qaddafi thing the alleged Libyan hit squad came up. I was just referring to that teasingly and maybe I shouldn't have. No," the president continued, "I don't have any concerns . . . You can't live that way."

Reagan learned of the incident when he and his guests of honor were having after-dinner coffee in the Blue Room. National security adviser William Clark and Deputy Chief of Staff Michael Deaver huddled with the president and Vice President George Bush.

Clark said they also were telling the president that a British helicopter was down in the Falkland Islands. "He wants to be informed," Clark said.

Reagan expressed relief that the pope had not been hurt, and said, "Thank God nothing happened."

Vice President Bush said, "What a terrible time we're living in."

During the after-dinner toast, President Reagan referred to the British-Argentine conflict over the Falklands, though not by name.

"Your visit coincides with one of the most serious challenges to peace this hemisphere has ever known," the president told Figueiredo and the 121 black-tie dinner guests after they finished their Breast of Capon Eugenie and Mocha Bombe Borboleta topped with sugar butterflies.

"I think you know how hard the United States, linked by friendship to both countries involved in the South Atlantic conflict, worked to prevent war and to bring peace. We all hope and pray peace efforts now under way in New York will yield fruit," he said.

The crisis in the South Atlantic was also very much on Figueiredo's mind, and the reason he cut short his visit here by a day from his original schedule.

"This is a moment of deterioration of the international political crises," Figueiredo said. "My government believes it is essential that the west, in which your country plays such a vital role, deploy its best possible efforts to reinforce its ties of mutual trust with the developing world."

Besides Mary Martin, who lives part of the year in Brazil, and Debbie Reynolds, who used to be at MGM with another starlet named Nancy Davis, there were two other movie stars on the guest list: Rhonda Fleming and Dina Merrill.

There was also a new chief of protocol with ambassador rank--Selwa Roosevelt, whom the Senate confirmed earlier this week.

On the economic front, at least one congressman, Rep. Sonny Montgomery (D-Miss.), got the high-sign from the president on the budget. "Don't let them whack away that defense budget," the president told Montgomery, who replied, "We're not."

Later, Montgomery told reporters that "we are all going to have to give up something, including the president."

The entertainment was by Brazil-born Sergio Mendes, and his Brazil '88 group, doing a lively revue of bossa-nova and samba. Mary Martin, who had sung "Happy Birthday" in Portuguese to Dulce Figueiredo a little earlier in the Blue Room, couldn't stand still at the rear of the East Room when Mendes performed. So she did an impromptu samba.

The Mendes gig was another Frank Sinatra Production, as the official White House impresario. He dropped in for the afternoon rehearsal to help engineers balance the sound. He chose the group because "obviously they speak Brazilian, they sing Brazilian songs and they're known in the U.S." And Sinatra flew off to New York before the festivities began.

Guest list for last night's White House dinner.

Ramiro Saraiva Guerreiro, minister of foreign relations of Brazil, & Gloria Guerreiro

Ernane Galveas, minister of finance

Joao Camilo Penna, minister of industry and commerce

Helio Marcos Penna Beltrao, minister for social security, & Mario Beltrao

Brig. Gen. Damilo Venturini, chief of the military household

Joao Leitao de Abreu, chief of the civilian household

Antonio Delfim Netto, minister of planning

Sen. Jose Sarney

Antonio F. Azeredo da Silveira, Brazilian ambassador to the United States, & May Paranhos Azeredo da Silveira

Maj. Gen. Octavio Aguiar de Medeiros, chief of the National Information Service

Gen. Lew Allen, chief of staff, U.S. Air Force

Ernest & Betty Lou Angelo, Midland, Tex.

James A. Baker III, chief of staff and assistant to the President, & Susan Baker

Malcolm Baldrige, secretary of commerce, & Margaret Baldrige

Terrel H. Bell, secretary of education, & Betty Bell

Helen Bie, Green Bay, Wis.

John Block, secretary of agriculture, & Sue Block

W. Michael Blumenthal, chairman, Burroughs Corp. and chairman, Brazilian Business Council

Vincente J. Bonnard, president, Brazilian-American Chamber of Commerce, & Mrs. Bonnard

Gerald Boyd, White House correspondent, St. Louis Post Dispatch

Vice President George Bush & Barbara Bush

Margaret Bush

Edward W. Carter, chairman, Carter Hawley Hale Stores Inc., & Mrs. Carter

Frank T. Cary, chairman, IBM Corp., & Anne Cary

Sen. John H. Chafee (R-R.I.) & Virginia Chafee

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

William Coleman Jr., senior partner, O'Melveny & Myers, & Mrs. Coleman

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

Armand S. and Harriet Deutsch, Los Angeles

Rep. William L. Dickinson (R-Ala.), & Barbara Dickinson

Lawrence S. Eagleburger, undersecretary of state for political affairs, & Marlene Eagleburger

Thomas O. Enders, assistant secretary of state for inter-American affairs, & Gaetana Enders

Dr. Edwin J. Feulner Jr., president, Heritage Foundation, & Linda Feulner

Elizinha Goncalves, Rio de Janeiro

Edwin L. Harper, assistant to the president for policy development

William R. Hearst Jr., chairman, Hearst Corp., & Mrs. Hearst

Sen. Howell Heflin (D-Ala.) & Elizabeth Ann Heflin

Terence Hunt, White House correspondent, Associated Press

Mrs. Henry Ittleson, New York City

Jeanie Johnson, Silver Spring, Md.

Sen. J. Bennett Johnston (D-La.) & Mary Johnston

Justice Mildred L. Lillie & A.V. Falcone, Los Angeles

Ted Mann & Rhonda Fleming

Mary Martin, actress & singer

John Mazzola, president, Lincoln Center for the Performing Arts, & Mrs. Mazzola

Ursula Meese

Constance Mellon, New York City

Sergio Mendes, pianist, & Maria Mendes, performer

Dina Merrill, actress

Ambassador J. William Middendorf, permanent representative of the United States to the Organization of American States, & Isabelle Middendorf

Rep. G.V. (Sonny) Montgomery (D-Miss.)

Marcus Vinicus Pratini de Moraes

Langhorne A. Motley, U.S. ambassador to Brazil, & Mrs. Motley

Alejandro Orfila, secretary general of the Organization of American States, & Helga Orfila

Justice William Rehnquist & Natalie Rehnquist

Debbie Reynolds, actress

Nancy Reynolds, vice president, Bendix Corp.

Robert C. Robb, Devon, Pa.

Rodman C. Rockefeller, chairman, International Basic Economy Corp., & Sascha Rockefeller

Selwa Roosevelt, chief of protocol, & Archibald Roosevelt

Dr. Albert B. Sabin, Medical University of South Carolina, & Mrs. Sabin

Edmond Safra, chairman, Republic National Bank, & Lilly Safra

Mildred Deveraux

John Sargent, chairman, Doubleday & Co.

Marvin Schur, J. Aron & Company Inc., & Edith Schur

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

Dr. Laerte Setubal, president, Associacao de Exportadores Brasileiros

John S.R. Shad, chairman, Securities & Exchange Commission, & Patricia Shad

Dr. William C. Sheldon (Margaret), chairman, Department of Cardiology, Cleveland Clinic, & Margaret Sheldon

Rep. Gene Snyder (R-Ky.) & Patricia Snyder

Dr. Leonard Spearman, president, Texas Southern University, & Daleria Spearman

Arianna Stassinopoulos, author

Mack Verhyden, vice president, Caterpillar Tractor Co., & Mrs. Verhyden

Anne B. Vollman

Ben Washer