The Soviet Union, which is secretive about the details of its own space program, showed a videotape of the explosion of the U.S. shuttle Challenger on its evening news last night, giving Russians a rare view of a space mission accident.

The Soviet ambassador to the United Nations, Vasily Safronchuk, joined representatives of other nations in extending condolences to the United States and particularly to the families of the five men and two women who died in the accident, news agencies reported.

The Soviet Union has announced the deaths of four Soviet cosmonauts in two accidents, both of them on landing. Vladimir Komarov was killed in a crash-landing in 1967, the same year three American astronauts died in a launch-pad fire during training. Three Soviet cosmonauts died during the reentry of their Soyuz-11 spacecraft in June 1971, apparently because a faulty valve depressurized the capsule.

In October 1983, U.S. intelligence sources reported that a Soviet rocket had exploded as it was about to be launched, but the capsule with three cosmonauts aboard was separated in time and they parachuted to safety.

There have been rumors of other accidents but little information has been made public. Last August, the Communist Party newspaper Pravda reported that two months earlier two cosmonauts had made a risky repair mission to fix a Salyut-7 spaceship that had been drifting and out of touch with Earth.

Moscow rarely has permitted live coverage of a space launch, and the general practice is to show a launch or landing on television only after it has been completed successfully.

World leaders expressed their shock and sorrow at yesterday's accident, and many stressed the importance of continuing space exploration.

Canadian Prime Minister Brian Mulroney said in a live television broadcast that the explosion was "a terrible loss in remarkably tragic circumstance." But he added that the accident "ought not discourage us from participating in this great adventure."

Irish Prime Minister Garret FitzGerald and President Patrick Hillery sent telegrams to President Reagan.

"The Irish people and government share the profound shock and sadness of the American people," FitzGerald said. "We have long admired the courage of the shuttle crews who have accomplished so much for America and for scientific achievement in space."

French President Francois Mitterrand, in a telegram to Reagan, said, "The French people felt, at the announcement of the explosion of the space shuttle Challenger, a profound emotion and sincere compassion for the astronauts aboard."

China's official New China News Agency reported the accident in a three-paragraph dispatch from Washington, saying: "It appeared there is no way that the seven people on board could survive."

In several countries, men who had trained to go on shuttle flights praised the Challenger's crew and said the program should continue, news agencies said.

Patrick Baudry, a Frenchman who traveled aboard the shuttle Discovery in June, said: "I think the sacrifice of my friends who were on board today will not be for nothing. There have been other accidents before. They have all served some purpose."

A spokesman for two British men scheduled to begin training this week for a flight on the shuttle Columbia said they were "devastated" by the news. The two are Squadron Leader Nigel Wood and Lt. Col. Richard Farrimond.

Japan's Kyodo news service quoted Takao Doi, one of three Japanese training for shuttle missions, as saying a Japanese astronaut had been scheduled for a future Challenger flight.

"It seems the accident occurred at the most dangerous moment. Once the solid fuel is ignited you can't control it," Doi said.