Foreign leaders appalled at the attempted assassination of President Reagan yesterday, expressed their shock and dismay in messages quickly dispatched to the White House.

British Prime Minister Margaret Thatcher, who was the first European leader to meet with Reagan after his inauguration when she visited Washington in Feburary, was said by a spokesman to be shocked and distressed by the news. She immediately sent a message to the president saying that she "prayed" that his injuries are not serious. Queen Elizabeth II, saying "I was very shocked to hear about the attack," wished him a speedy recovery.

West German Chancellor Helmut Schmidt, who had spoken by telephone to Reagan yesterday, sent a telegram expressing hope "very much that the news that you are not seriously hurt is accurate." The West German leader also extended "good wishes" to your colleagues who also were hurt." White House press secretary James S. Brady, a Secret Service agent and a District police officer were wounded in the assassination attempt.

In Moscow, the assassination attempt was reported without comment by the official Tass news agency in a nine-line dispatch issued an hour and 15 minutes after the news was urgently reported elsewhere.

French President Valery Giscard d'Estaing heard of the assassination attempt in a bulletin read out on French television during a campaign interview with him. "Unfortunately, we live in a world of violence which France is spared from perhaps more than others," he said, and his message to the White House conveyed "warmest and most friendly wishes" for the president's recovery and continuance of his leadership of the United States.

The Chinese Foreign Ministry reported Premier Zhao Ziyang cabled Reagan that he was "shocked to learn of your being wounded."

Japanese Prime Minister Zenko Suzuki, who is scheduled to be in Washington to see the president on May 7, said he was praying for Reagan's recovery.

Spain's King Juan Carlos telephoned the White House upon hearing of the attack to inquire after the president's condition. The Spanish monarch was reported to have expressed his "full solidarity against the criminal attack which disgracefully proved that terrorist violence today is generalized." Prime Minister Lepoldo Calvo-Sotelo followed that call with a message of regret for the attack and hopes for Reagan's quick recovery.

Portugese Primier Francisco Pinto Baslsemao, who was meeting with foreign reporters in Lisbon when he recieved news of the attack, said he felt "rupungance and condemnation for this act against the United States."

In Rome, Amintore Fanfani, president of the Italian senate and acting president of Italy, sent a telegram to Reagan expressing hope for his quick recovery.

Canadian Prime Minister Pierre Trudeau assailed the "insane assault" on Reagan and sent a message expressing his "deep distress and shock."

In Cario, Egyptian President Anwar Sadat, expressing "extreme shock and sorrow," condemned the "criminal action, which jolted the entire world."

Israeli Prime Minister Menachem Begin reacted "with shock and astonishment" and Foreign Minister Yitzhak Shamir cabled Reagan wishing him a speedy recovery.

Chilean President Augusto Pinochet also cabled the White House after the attack.

Brazilian President Joao Figeiredo cabled Reagan of his deep dismay and "profound sympathy," and the Argentine Foreign Ministry condemned "this expression of violence."

In Lima, Peruvian President Fernando Belaunde Terry called U.S. Ambassador Edwin G. Corr to express his concern, and Defense Minister Jose Guillermo Garcia of El Salvador, the violence-wracked Central American country, called the assassination attempt "incredible . . . an act to regret."

At the United Nations, Secretary General Kurt Waldheim said in his messge to Reagan, "I wish to convey the sense of deep concern and dismay felt by the entire international community at this despicable act." Waldheim "strongly condemns this wanton act of terrorism," a U.N. spokesman said.

In New Zealand, where it was Tuesday when the attack on Reagan occurred, Prime Minister Robert Muldoon expressed shock at "this violent incident." In Canberra, Australian Prime Minister Malcom Fraser said, "It is my fervent hope that Mr. Reagan is given an opportunity to carry out his policies."