HUNTSVILLE, Ala. (AP) _ Shuttle astronauts reviving the teacher-in-space dreams of Christa McAuliffe beamed a celestial lesson to 41 middle school students Friday, allowing the problem-plagued Columbia mission to create the first ''space classrooms.''

''You may have heard of some of the problems we've been having,'' astronaut Jeffrey Hoffman told the youngsters watching him on television screens at two NASA centers. ''It's been quite an interesting and dynamic mission.''

The shuttle's $150 million Astro observatory, crippled by computer failures, was put back in operation Friday with the help of commands sent from the ground. But possibly more significant, the lessons beamed from 218 miles above Earth to American schoolchildren helped the space agency regenerate some of the goals struck down in the Challenger disaster.

''We weren't trying to take the place of what they were going to do on Challenger,'' said Karen Widenhofer, a Madison County, Ala., teacher on temporary assignment with NASA who assisted in the classroom Friday at Marshall Space Flight Center at Huntsville. ''But this shows that NASA is still interested in education and encouraging students in science and math.

''NASA still plans to put a teacher in space.''

Friday's space lesson, conducted by four of the seven astronauts aboard Columbia, took place nearly five years after the Jan. 28, 1986 explosion of Challenger that killed all seven aboard that shuttle, including Mrs. McAuliffe, a New Hampshire schoolteacher.

Denny Elkins, a ninth-grader from Snellville, Ga., was one of the 12 middle school students from four southeastern states who sat at a horseshoe-shaped desk in the space classroom at Marshall. He said he was watching on TV when Challenger's liftoff turned into a fireball in the sky.

''I saw it live because I already was interested in space travel,'' he said. ''The explosion with the biggest impression of my life. I really wanted to be an astronaut, but when I saw that, I said, 'No.'''

''Now,'' he said, ''I'm reconsidering.''

During the opening 35-minute lesson, which was about 15 minutes late because of a communications linkup problem, Hoffman wore a dress shirt and tie. Usually astronauts wear casual clothes except for the space suits put on for takeoffs and landings.

''When I started thinking about giving a classroom talk in space, I thought back to my own school days and I realized that all of the men teachers I had wore ties,'' Hoffman said.

''As far as I know, nobody's ever worn a tie in space. I thought I'd give it a try and see what it looks like in celebration of this space classroom occasion, and I can tell you it works quite well. You have to be a little careful in zero-gravity as you can see,'' Hoffman said, pushing down his floating, burgundy patterned tie.

After Hoffman and astronaut Sam Durrance conducted their lesson, focusing on star formations and celestial radiation, Ms. Widenhofer gave students at Marshall about an hour-long class. Another 29 students took part in a similar space classroom at Goddard Space Fllight Center in Greenbelt, Md. The space schoolhouse concluded with astronauts Ron Parise and Robert Parker fielding questions from the students on Earth.

''I'd like to know what is the most tedious and painstaking part of your mission so far?'' said Mario Trimble, ninth-grader from Montgomery, Ala.

''When you fly a mission, most of the time is scheduled very tightly and there are a lot of things to do,'' responded Parise. ''Unfortunately, some failures with computer terminals have caused us to redo the way we're doing our mission. We're slowly working around everything.''

Bart Doran of Glen, Miss., wanted to know how the problems had affected the Columbia's missions.

''Very greatly,'' astronaut-astronomer Parker said, explaining that some of the telescope operations had to be done by hand instead of by computers.

Troubles persisting throughout the mission have forced the astronauts to miss more than 100 planned observations. About 250 celestial targets were to have been studied.

The two computers able to run the observatory's three ultraviolet telescopes both failed. Flight director Gary Coen said the cause of the computer failures has not been determined and he didn't know if it was connected to a lint buildup in the equipment.

On Friday, the Astro observatory was being run by commands sent from the ground to guide the telescopes toward their desired targets. The astronauts used a joystick and, aided by information from the ground, zeroed in on objects.

The success of this process Thursday night and Friday gave scientists hope that many more observations can be made before Columbia's 10-day flight ends Tuesday.

''Our attitude here is that we've got a mode we feel is going to work and we're going to go get the science,'' mission manager Jack Jones said. But he added he didn't know yet how efficient the operation would be.

Spacelab Mission Operations Control's John David Bartoe congratulated the astronauts Friday morning for obtaining ''fantastic'' observations of a quasar, one of the most distant objects in the universe. All three ultraviolet telescopes focused on the quasar for 51 minutes, three minutes longer than planned.

''That's what happens when you have good, old-fashioned astronomy ... and a little bit of help from your friends,'' Parker told Bartoe.

The space classroom programs will be available via some cable television companies to classrooms.

To illustrate the importance of studying all types of radiation emitted from celestial objects, Durrance played two versions of the theme from the film ''Star Wars.''

Low and high-frequency notes were filtered electronically from the first version, and the taped music was unrecognizable. The same measures then were played with all the notes.

''As you can see, you need to hear all the notes to recognize the song to appreciate its full musical quality,'' Durrance said. ''Studying the universe is the same way. The universe is playing a kind of symphony in the light that its produces.

''Up here in space, our telescopes can see all the radiation to better understand the universe. That's why some other astronomers and I are in the shuttle this week using an observatory called Atro to study the stars.''

The youngsters will tour Marshall and talk with its scientists and control team members by the time their visit ends Sunday. Marshall is the location of Spacelab Mission Operations Control, which is in charge of Columbia's astronomy work.

Willie Carter, an eighth-grader from Memphis, Tenn., said the country ''is sort of regaining from the Challenger explosion. This has probably put more hope in all of us. I feel better now that we've got something going compared to the explosion.''