Gilbert V. Levin, a scientist whose research company participated in NASA missions to Mars and who was the principal designer of an experiment aimed at detecting the possibility of life on Mars, only to face skepticism from the scientific establishment, died July 26 at a hospital in Bethesda, Md. He was 97.

The cause was an aortic dissection, said his son Henry Levin.

Dr. Levin (pronounced luh-VIN) began his career as a sanitation engineer before becoming a space scientist and founding his company, Biospherics (later Spherix Inc.), based in Washington’s Maryland suburbs.

He had dozens of patents and helped develop an experiment for the Mariner 9 mission, which orbited Mars in 1971. His best-known scientific work, however, has never been fully accepted by the wider scientific community.

For the better part of a decade, Dr. Levin — later assisted by a colleague, Patricia Ann Straat — worked on an elegantly simple effort to test soil on Mars for the presence of organic material. Their “labeled release,” or LR, experiment was one of several carried out by NASA’s two-part Viking mission to measure whether Mars could support life. The first Viking lander reached Mars in July 1976, with Viking 2 touching down on a different part of the planet in September.

Dr. Levin’s experiment employed a nine-foot arm to scoop Martian soil into a container, where it was treated with a solution containing radioactive carbon nutrients. Monitors detected the release of radioactive gas, which Dr. Levin interpreted as evidence of metabolism.

“Gil, that’s life,” Straat said when they saw the results.

The findings held true for both Viking 1 and Viking 2, which took samples from different regions of the planet. Other experiments aboard the Viking, however, used different methods to conclude that Martian soil did not contain carbon, an element found in all living things.

Dr. Levin stood by his findings, but top NASA scientists disagreed, saying that the response he observed was the result of inorganic chemical responses, not biological processes.

“Soon thereafter,” Dr. Levin told the Johns Hopkins University School of Engineering Magazine last year, “I gave a talk at the National Academy of Sciences saying we detected life, and there was an uproar. Attendees shouted invectives at me. They were ready to throw shrimp at me from the shrimp bowl. One former adviser said, ‘You’ve disgraced yourself, and you’ve disgraced science.’ ”

Dr. Levin never wavered in his belief that some form of life existed on Mars. Subsequent NASA missions to the planet — more than 10 in all — found evidence of water and methane, further indications of the possibility of life-forms, in Dr. Levin’s view. He lobbied NASA for permission to conduct additional experiments, but in the 45 years since the Viking mission, there has not been another attempt to determine whether Mars supports biological life.

“It’s been left as an ambiguous result,” Paul Davies, a theoretical physicist at Arizona State University and a friend of Dr. Levin’s, said in an interview. “The experiments are not sufficiently definitive, but they clearly leave open the possibility of life on Mars.”

As recently as 2019, when he published an essay in Scientific American, Dr. Levin continued to defend his original work, writing, “It is more likely than not that we detected life.”

He was an engineer by training, not a physicist or biologist, and never held a staff job at NASA. Some colleagues have speculated that professional jealousy may have played a part in the dismissal of Dr. Levin’s findings by leading NASA scientists.

“Gil’s a sanitary engineer, he’s not a biologist,” Viking project manager James S. Martin told The Washington Post in 2000. “I’ve often wondered if one of his problems was that he wasn’t a member of the club.”

Gilbert Victor Levin was born April 23, 1924, in Baltimore. His father, a Jewish immigrant from Lithuania, had an antiques business. His mother was a homemaker.

Dr. Levin interrupted his studies at Johns Hopkins University during World War II to serve as a radio operator with the Merchant Marine. He served aboard five ships in the Atlantic, Pacific and Mediterranean theaters.

He received a bachelor’s degree in civil engineering in 1947 and master’s degree in sanitary engineering a year later, both from Johns Hopkins. He was a public health engineer in Maryland, California and D.C., and also worked as a research scientist in the 1950s and 1960s.

A chance meeting with a NASA scientist at a party in 1958 led Dr. Levin to begin work on the experiment that ultimately went to Mars almost two decades later. He received a doctorate in environmental engineering from Johns Hopkins in 1963, then worked at Hazleton Laboratories in Vienna, Va., for three years.

He was about to take a professorship at Colorado State University in 1967 when a former boss told him that he was closing his research laboratory. Dr. Levin bought the space, above a plumbing store in Washington, and named the company Biospherics. It was later headquartered in Rockville and Beltsville, Md.

“I felt if I could get my own research company going, I could do more different things than I could in the research department at a company or university,” Dr. Levin told Warfield’s, a Maryland business magazine, in 1991.

Biospherics, which had 750 employees at its height, won government contracts to perform environmental assessments, design monitors to measure discharges from Navy ships and conduct call centers for federal agencies.

At least two of Dr. Levin’s inventions showed considerable commercial promise. The first, a process to remove phosphorus from wastewater, was used at several sewage treatment plants around the world. The other, an offshoot of his work for NASA, was an artificial sweetener derived from a form of “left-handed” sugar with molecules arranged in the opposite direction of standard sugar. The result was a sweetener that had fewer calories and would not cause tooth decay. Marketed as Lev-O-Cal, it was briefly used in Slurpees, but it proved too expensive to produce in large quantities.

“I’m a lousy salesman,” Dr. Levin said, lamenting his modest success with the sweetener and the wastewater treatment method. “I’ve got two of the best technologies in the world, and I can’t sell them.”

Dr. Levin, who retired in 2008 but remained active in science until his death, was awarded the NASA Public Service Medal and the Newcomb Cleveland Prize of the American Association for the Advancement of Science. He was a member of the Johns Hopkins University board of trustees. He lived in Chevy Chase, Md., and Palm Beach, Fla.

His wife of 66 years, the former Karen Bloomquist, who was a Newsweek correspondent and a vice president of Biospherics, died in 2019. Survivors include three children, Ron Levin of Los Angeles; Henry Levin, a molecular biologist at the National Institutes of Health, of Chevy Chase; and Carol Sanchez of Wake Forest, N.C.; and six grandchildren.

In recent years, more scientists have come around to thinking that Dr. Levin’s 1976 Mars experiments may have merit, and that he may be proved right in the long run.

“He never gave up and was unfailingly cheerful and positive,” Davies, the Arizona State professor, said of Dr. Levin. “That’s a lesson for us all, from someone who devoted his life to science and remained positive about it.”

An earlier version of this article incorrectly stated that the Newcomb Cleveland Prize was awarded by the American Academy of Arts and Sciences. It was awarded by the American Association for the Advancement of Science. The article has been corrected.