Navy Lt. Robert S. Ellis, 29, a student at the U.S. Naval Test Pilots School at Patuxent River Naval Air Station in Maryland, was killed Thursday when the helicopter he was flying crashed and burned on a highway near Chaptico, Md. He lived in Hollywood, Md.

A Navy spokesman said Lt. Ellis and his instructor were killed instantly when their Cobra light attack helicopter crashed onto Rte. 238 in St. Mary's County and burst into flames during a training flight. The spokesman said the crash was being investigated by a Navy board of inquiry.

Born in Vallejo, Calif., Lt. Ellis was the son of a retired Navy captain. He graduated from Anndandale High School in 1970 and earned a bachelor's degree in nuclear engineering from the University of Viriginia, where he was a member of the Reserve Officers Training Corps., in 1975.

He completed basic flight training at Pensacola, Fla., and later was assigned to attack squadrons aboard the aircraft carriers USS Independence and USS Eisenhower. He was selected for test pilot training in June 1980. He was to graduate on June 12.

Survivors include his wife, the former Catherine C. Armstrong, and a son, Michael G. A., both of Hollywood, Md.; his parents, Capt. and Mrs. Samuel S. Ellis of Centreville, Va.; a brother, Frank W., of Fairfax, and a sister, Elizabeth Ellis Glowa of Boston.

The family suggests that expressions of sympathy be in the form of contributions to the American Heart Association.