William R. Graham, who came to prominence as acting administrator of NASA during the aftermath of the Challenger accident, is the leading candidate to be named science adviser to the president, a White House source said yesterday.

The director of the White House Office of Science and Technology Policy post, vacated Dec. 31 by George W. (Jay) Keyworth II, has been occupied by acting directors.

Last week the top officials of the country's largest scientific society, the American Association for the Advancement of Science, criticized the White House for allowing the job to go so long without a permanent appointment.

They said it was crucial for the White House to have an independent source of scientific advice at a time when the nation faces such imminent major policy decisions as the future of the post-Challenger space program and whether and how to proceed with the "Star Wars" program of research on antimissile defense.

Graham became acting administrator of the National Aeronautics and Space Administration early last December after his predecessor, James M. Beggs, stepped down to fight an indictment on criminal charges unrelated to the space agency. Last month Graham stepped down when James C. Fletcher, a former NASA administrator, was reappointed to the job he left in 1977.

Graham, a physicist and electrical engineer, has done considerable work on weapons systems with the Hughes Aircraft Corp., at the Air Force Weapons Laboratory in New Mexico and as a planning analyst with the Rand Corp. in California. In the three years before his NASA appointment, Graham was chairman of the White House Advisory Commission on Arms Control and Disarmament.

Graham's candidacy for the science adviser's post is not likely to win wide support in the scientific community because he does not have the reputation of most of his predecessors. The post has traditionally been filled with those who had national or international reputations as outstanding scientists.

Keyworth, a virtual unknown when he took the post, received mixed reviews from the scientific community, most scientists criticizing him for reversing the traditional role of the job. Most of his predecessors were conduits for outside scientific advice to the White House; Keyworth became the White House spokesman to the scientific community and was best known for his promotion of the Star Wars program.

Graham's background in weapons research and his backing from the conservative Heritage Foundation, which urged his appointment to NASA, is seen as likely to perpetuate the Keyworth model.