A hopelessly incompetent recruit, Leonard is undone by the traumas of boot camp, a humiliating ordeal with a gruesome denouement. The pivotal role was won by Mr. D'Onofrio at a distance of thousands of miles; Mr. Kubrick cast him on the basis of several videotaped auditions and a taped interview that Mr. D'Onofrio mailed to the director in England. A Change in Perceptions

The 27-year-old actor originally learned that the part was available from Matthew Modine, an old friend and the star of ''Full Metal Jacket.'' ''I rented a home video camera, found a green stoop that resembled an Army barracks, put on an Army cap and green fatigues and did a monologue about a rookie cop, except that I left out all the lines about cops,'' Mr. D'Onofrio recalled. ''I sent it off and got a call right back.''

The hard part was having to gain all that weight, which proved as difficult as losing it later.

''I gained weight everywhere,'' Mr. D'Onofrio said. ''My thighs were tremendous, my arms were tremendous, even my nose was fat. I had a tough time tying my shoelaces, but this was the only way I could play Leonard, because I had to be weak-minded in the same way. Because of the weight and the fact that he was totally out of his element, Leonard's mind became weak. He was slow to start, a country bumpkin, but I don't think he was insane. What they did to Leonard was they made him into a very efficient killing machine.''

Inhabiting Leonard's body had a profound effect on Mr. D'Onofrio's perceptions. ''It makes you realize all those typical things about beauty being deeper than what you would think,'' he said. ''When you look at people, you should look at more than what you see on the surface; you should try to find a soul. That was thrown in my face every day - every time I tried to hail a cab.'' Offbeat Roles

Mr. D'Onofrio has frequently found himself playing the handicapped or disturbed; on Broadway, he was cast as a young man with a speech impediment in ''Open Admissions,'' and his television roles have included a 250-pound killer and, in another segment, a mentally retarded man unjustly accused of murder, on ''The Equalizer.''