NASA has awarded a $330.6 million contract to the aerospace company Lockheed Martin to design and build a robot spaceship to carry replacement parts to the Hubble Space Telescope to keep it operating for five to seven years.

In another, widely expected move, NASA awarded a preliminary $144 million contract to the Canadian firm MD Robotics to provide the "grappling arm" that will help the unmanned spaceship dock with the telescope, and a "dexterous robot" to mount the new instruments inside it.

NASA spokeswoman Susan M. Hendrix, of NASA's Goddard Space Flight Center, said Monday the agency awarded the MD Robotics contract Friday. A NASA Acquisition Internet Service bulletin said the agency granted the "De-Orbit Module" contract to Denver-based Lockheed Martin Space Systems Co. on Sept. 24.

NASA has said for months that it needed to begin work on a robotic servicing mission this fall to have the spacecraft ready by the end of 2007, when Hubble's batteries are expected to give out, causing the telescope to shut down within hours.

Still, "we haven't totally discounted" a manned repair mission by the space shuttle, Hendrix added in a telephone interview. "We're still maintaining our options for a shuttle servicing mission."

NASA Administrator Sean O'Keefe, who canceled a planned shuttle servicing mission because of safety concerns after last year's Columbia tragedy, reversed course in August, saying the agency would plan a robotic mission.

Carlos McKenzie a Goddard procurement officer, said MD Robotics, of Brampton, Ontario, had been awarded a "letter contract" good for three months, until Congress finalizes NASA's 2005 budget.

MD Robotics is under contract to the Canadian Space Agency to build a stick figure-like robot nicknamed "Dextre," whose performance as an orbital mechanic so impressed Goddard engineers that NASA embraced it over the summer as the key component of the servicing mission. MD Robotics did not respond to telephone inquiries yesterday.

Hendrix said Lockheed Martin's contract was not provisional but will be "incrementally funded" as money became available. Lockheed Martin issued a statement saying "we're all looking forward to NASA's public announcement, and we respectfully reserve comment until that time."

Aerospace engineers have said that a Hubble De-Orbit Module will have many potential uses, because it will give the United States a robotic cargo-carrying capability in space, a capability currently possessed only by Russia.

Hendrix said Goddard will oversee and design the Hubble mission. Goddard will also build an "Ejection Module" that will be loaded on the robot ship to hold Dextre, MD Robotics' grappling arm and replacement instruments.

The grappling arm will hold onto the telescope until the spacecraft can dock with it, Hendrix said. Dextre will then open Hubble's cargo bay and insert the new instruments.

Hendrix said one of these, Wide Field Camera 3, has room inside its casing to hold three to six new gyroscopes that Hubble needs to control its attitude in space. The De-Orbit Module will carry Hubble's new batteries, which will be connected through the docking junction.

Once the jobs are finished, the Ejection Module will jettison Dextre and the grappling arm, which will burn up in the atmosphere.