When Walter Gilbert was a student at Sidwell Friends School, he often played hooky, cutting class after class, despite stern warnings from instructors at the exclusive Northwest Washington school.

But unlike children who flee the confines of a classroom for the darkness of an afternoon movie or to seek the sunshine of a spring day, Gilbert traded the classroom for a tiny study carrel tucked away in the catacombs of the Library of Congress where he spent hours poring over science books that were so complex they often mystified his teachers.

Now, 31 years later, the quiet school boy who preferred the library to the classroom has won the 1980 Nobel Prize in chemistry.

"The school and I finally came to an understanding," Gilbert recalled yesterday during a telephone interview from his office at Harvard University. y"I promised to stay in class most of the time if they would let me get down to the library as often as possible."

Gilbert, 48, is one of two Americans and a Briton awarded the prize for their work in the controversial field of genetic engineering, whoch has been described as "tampering with life" by those opposed to the research. Frederick Sanger, 62, of Cambridge University in England, and Paul Berg, 54, of Stanford University, share the prize.

Gilbert developed a simpler and quicker method of deciphering DNA (deoxyribonucleic acid), which means scientists now can tell the exact chemical construction of genes and determine which parts are missing or defective -- a cause of some genetic diseases.

This technique makes it possible to isolate and remove specific genes so that they may be transplanted into other animals or even orther species.

Neither the prize nor the subject matter suprised H. Hall Katzenbach Jr., a longtime English teacher at Sidwell Friends. "I was teaching students how to do research papers and [Gilbert] turned in a paper that had something to do with the inheritance of the characteristics of fruit flies," Katzenbach recalls, laughing. "Imagine, a student in the 11th grade already doing detailed genetic work.

"Yes, I certainly remember him."

Gilbert's file at the school is filled with honors and awards won by a student, who was known as Wally, regarded as shy, and considered the proverbial bookworm.

"What made him stand out," Katzenbach remembers, "is that he was equally brilliant in writing and mathematics, which is unusal. He was an excellent writer. He wrote lots of poetry, but it was science that captivated him."

Gilbert not only got straight A grades at Sidwell Friends, which he entered in ninth grade, he got A-plus marks -- the highest possible -- in science, math and English, his records show.

He won a city-wide science fair contest in 1948; corresponded with members of the National Research Council, a group of government scientists, and was awarded a scholarship to Harvard in 1949 where he majored at first in chemistry and later physics. After graduation, he attended Cambridge where he received his doctorate in theoretical physics. He returned to Harvard to teach.

In 1960, he became fascinated with molecular biology and began work on gene-splicing techniques that led to more awards and recognition, including a National Academy of Sciences award in 1968.

"He always was brilliant," says Jonny Orbeck, a Sidwell Friends classmate, "but I really didn't know him very well, even though we were in radio club together. He was quiet and he had a very good sense of humor, but I can't remember anyone really being close to him."

Gilbert enrolled at Sidwell Friends because his father wanted him to learn Latin.

"I remember my father saying that everyone had to know Latin and there weren't any schools in Virginia which taught it, so he decided I should go to school in D.C.," he said. "It was a good school and I have good memories of it."

The Gilbert family moved to Arlington in 1939 when Gilbert's father, Richard V. Gilbert, an economist, joined a New Deal "brain trust" under economist Harry Hopkins.

"At about the same time, I.F. Stone came to town and he and my father became good friends," Gilbert recalls. His father's friendship with the Washington journalist resulted in Gilbert meeting Stone's daughter, Celia, whom he married in 1953.

Gilbert says his childhood in Virginia was typical "except for an occasional laboratory mishap at home."

"I was pretty shy back then," says Gilbert, "more comfortable with books than parties."

Despite his shyness, Gilbert's 43 classmates recognized his skills.

In the 1949 Sidwell Friends yearbook, called The Quarterly, they described him somewhat prophetically as a student of "unparalleled brillance and innate modesty . . . who will rise to unprecedented heights in the field of science someday."