The shuttle Discovery provided the space program with a 1.7 million-mile home run yesterday as it coasted back to Earth, completing a four-day mission that sent a robot probe to study the sun and ended the second-longest grounding of the shuttle fleet.

Discovery's commander, Dick Richards, told a cheering crowd later, "Like any great team, occasionally there's losing streaks. Today is a day we can say this losing streak is over."

Referring to the first shuttle flight in almost six months, space shuttle director Robert Crippen, a former astronaut, said, "If you criticize us for our mistakes, then you must also acknowledge our successes."

The National Aeronautics and Space Administration still is grappling with threatened congressional budget cuts to key programs, a flawed mirror in the $1.5 billion Hubble Space Telescope and persistent problems with hydrogen leaks in the shuttle fleet.

But yesterday's successful conclusion to the mission provided a badly needed morale boost for NASA.

"I'm elated," Crippen said. "It's been a long hot summer, I'll tell you that . . . . It's a high day for us."

About 5,500 spectators cheered as the spaceship touched down at 6:57 a.m. PDT, just as the sun rose over its desert landing strip at Edwards Air Force Base in California.

Brian Duffy at Mission Control in Houston told the five astronauts, "Glad to have you back, also to have the fastest man-made object in the universe well on its way."

He was referring to the Ulysses probe deployed from Discovery Saturday. It is expected to orbit the sun at 89,000 mph, almost 10,000 mph faster than the Voyager spacecraft whizzed past the outer planets.

Roger Bonnet, director of scientific programs for the European Space Agency, which built Ulysses, hailed its long-delayed sendoff as a "symbol of future cooperation between Europe and the United States."

Ulysses was reported 3.1 million miles from Earth, traveling at 25,451 mph on a course for Jupiter, where the giant planet's immense gravity is expected to give it a boost, bending its path at a right angle, down and back toward the south pole of the sun. It is to become the first spacecraft to fly perpendicularly to the plane in which the planets orbit the sun.

The craft is to pass into the unexplored regions around the sun's south polar region in 1994 and its north pole in 1995, studying the magnetic field and solar winds and their influence on Earth's climate.

After they deployed Ulysses, the astronauts' duties included starting a small controlled fire inside a container as part of a study on how fire, a shuttle safety concern, behaves in weightlessness. The crew of Columbia noticed sparks and smoke coming from a short circuit in teleprinter cables during a mission last year.

Discovery's crew also extended their craft's 50-foot robot arm, with special material attached, to test the amount of deterioration that space flight is causing on an Intelsat satellite stuck in a uselessly low orbit. Intelsat, the international consortium that owns the stranded satellite, is to study the results and decide whether to pay to send astronauts on a 1992 mission to rescue it.

The most reliable of the three orbiters, Discovery also flew the last shuttle mission, which in April deployed the Hubble telescope. Yesterday's mission ended the longest launchless period since the Challenger accident in January 1986 grounded the fleet 2 1/2 years.

The next flight is scheduled for early next month, when Atlantis is to conduct a secret military mission if it passes an advance fueling test. The mission, originally planned for July, was delayed by hydrogen leaks.

Technicians must also repair damage to Atlantis's engine room caused by a loose 9-foot, 70-pound metal beam that workers forgot to remove before the orbiter was hoisted from the horizontal to the vertical position last week.