Philip C. Habib, the State Department's ranking career diplomat, is resigning his post due to ill health, administration officials said yesterday.

His replacement as under secretary of state for political affairs is to be David D. Newsom, currently ambassador to the Philippines, officials said.

Habib, 58, suffered a cardiac arrest last December after having a serious heart attack in 1972. Known as a tireless, intense worker, Habib was told by his physician that he could not resume a high-pressure job at the present time. Unofficial reports said he is to be named diplomat-in-residence at Stanford University.

A native of Brooklyn and a devotee of blunt language and tough bargaining, Habib had long experience in Asia with service as chief political officer in Seoul and Saigon, political adviser to the Paris peace talks and assistant secretary of state for East Asian and Pacific affairs.

He became under secretary of state in July 1976 during the tenure of Henry A. Kissinger at the State Department and was kept on at the job as a key adviser by Cyrus R. Vance.

Newsom, 60, has a quieter, more typically diplomatic style. Most of his 31-year career as a diplomat has been centered on Africa and the Middle East, but since 1974 he has served as ambassador to Indonesia and then to the Philippines. Earlier, he was officer in charge of Arab Peninsula affairs, director of North African affairs, ambassador to Libya and assistant secretary of state for African affairs (1969-74.)

After a recent trip to Washington, Newsom has returned to the Philippines to wind up his present job. He is expected to assume his new post in about a month.