Space shuttle pilot Frederick Gregory was three blocks from his alma mater, Anacostia High School, when the countdown began. "Less than a minute," someone shouted as the honor guards snapped to attention, the red carpet rolled out, the cheerleaders twirled flags and the maestro struck up the band.

"This is so exciting," said La Treaviette Wilox, a 10th-grader holding balloons proclaiming Tuesday to be "Col. Frederick Drew Gregory Day" at the school. "This is the first time we have had a dude who went into space then came back to see us."

Gregory, wearing a light blue astronaut uniform, arrived moments later to the ecstatic cheers of many of the 1,500 students. It was a visit that couldn't have come at a better time.

Six months ago the school had been closed, following a spate of fires believed set by arsonists. Morale had been low, but Gregory knew how to keep more than a shuttle craft afloat. He was pretty good at lifting spirits, too.

"I circled the earth 110 times," Gregory told the students. "I looked out of my window to see if I could spot Anacostia High. I couldn't see it from up there, but now that I'm back I thank God it's still here."

After being introduced by Crystal Bowie, the school's 14-year-old oratory contest winner, Gregory kissed her on the cheek, sending the audience into shrills and swoons.

"Wow, these girls are psyched," exclaimed Antwahn Young, 15. "I want some fame, too."

"I'm so glad he came back," said Coburn Flippen, a student at the nearby Kramer Junior High who plans to attend Anacostia High next year. "It makes the school look better and gives us something to look forward to."

"Since the school has a bad name," said Jermaine Roberts, 13, "it shows that all the students are not ignorant."

Although Gregory gave the school high marks for career development -- which nowadays includes much-publicized job opportunities in the U.S. Air Force -- school officials concede that much work remains to improve the school's academic performance. While Anacostia High has its share of gifted students, it still has one of the highest dropout and failure rates of any school in the city.

Gregory graduated from Anacostia High in 1958, when its population was about half black and half white, with a predominantly white faculty. Today the school is predominantly black.

"It was pretty rough after the riots in 1968 , but things are on the upswing," said Harold Liberman, who has taught history at the school for 20 years. "We're seeing more middle-class values and more stable families that associate education with personal success. With our current school administration, I think we'll be seeing more Gregorys coming along."

Gregory emphasized that becoming an astronaut was a real possibility for any student who worked hard and had patience. Describing his flight in down-to-earth terms and using color slides of life inside the shuttle during the 2.5 million-mile voyage, the 44-year-old spaceman left the student body spellbound.

Gregory had been shuttled to and from public schools throughout the District since his return to Washington on Monday. But the return to Anacosita was special, with John Koontz, the school principal in Gregory's day, smiling broadly from a back row.

"It would be great if Anacostia could fly with me to space," said Gregory. "Just to see how beautiful this world is in which we live: the blues, the greens, the whites, the blackness of space filled with trillions of stars."

"Its like a grown-up bedtime story," declared Lea Adams. "If ever there was a man I wanted my son to be like, it's him."

Gregory had made history when he piloted the shuttle Challenger to a perfect landing. Now he had sent the students and faculty of Anacostia High into an orbit all their own.