Dr. C. Everett Koop, whose campaigns against smoking and AIDS marked an often-controversial eight years as surgeon general, told President Bush Thursday he will leave office in July. Koop, in a brief letter to the White House, said he had told Bush in February that he would not serve out his full second term, which ends in November. The surgeon general said he will leave July 13. Koop, 72, was appointed the government's top health officer by President Reagan and was sworn in in 1982.