LOS ANGELES -- Kim LeMasters, vice president of programming for CBS, was named head of its entertainment division yesterday, giving him the job of pulling the network out of the ratings basement.

LeMasters, 38, replaces B. Donald (Bud) Grant, who left Oct. 30 to start his own production company amid rumors that his job was in jeopardy. CBS has dropped from No. 2 to No. 3 in the A.C. Nielsen ratings this season.

LeMasters, an 11-year CBS veteran, was next in command behind Grant, and his appointment ended any speculation that CBS was still looking at such outside figures as independent producer Steven Bochco ("Hill Street Blues" and "L.A. Law") and Tri-Star motion picture production chief Jeff Sagansky.

The appointment was announced by CBS Broadcast Group President Gene F. Jankowski.

"We are extremely pleased with the fresh and exciting look Kim has given to our schedule and with his equally impressive development plans," said Jankowski in a statement.

Many of CBS' programs for the 1987-88 schedule have not fared well, especially "Tour of Duty" and "Frank's Place," two shows enthusiastically backed by LeMasters during a May meeting of CBS affiliates.

In the sixth week of the current season, NBC is first with 16.6 percent of the viewing audience; ABC is second with 14.5 percent; and CBS is in third place with 13.8 percent.