Tom Turnipseed, a firebrand state senator whose populist campaign for the Democratic nomination for governor has stirred up a political storm here, yesterday withdrew from the race on the recommendation of his physician.

Turnipseed, 41, an attorney whose attempts to build a coalition of black and white voters in South Carolina has sometimes been compared to the efforts of Huey Long in Louisiana five decades ago, announced from his hospital bed that he was quitting the political contest.

Turnipseed was admitted Friday night to Providence Hospital in Columbia, an institution which specializes in a coronary care, suffering from an irregular heartbeat, shortness of breath and nausea. His admittance to the hospital came amid mounting indications that his debt-plagued campaign was crumbling.

Turnipseed was hospitalized a year ago for diverticulitis, an intestinal ailment. During the primary campaign, Turnipseed confirmed news repoorts that he had received psychiatric care and electric shock treatments for mental depression three times during his high school and college days.

But those experiences, he said last year, helped him learn to react well under stressful situations. "I thrive on pressure," he told reporters.

Turnipseed's withdrawal from the June 13 Democratic primary race is not expected to elicit many expressions of sympathy from his fellow state senators, some of whom have publicly described him as a "demagogue" and a "crazy man." A number of colleagues had predicted privately for months that he would "self-destruct" before election day.

There had been financial difficulties might prevent Turnipseed from officially filing for the governor's race.

Ten days ago, the telephone lines in Turnipseed's campaign headquarters were shut off, allegedly for non-payment of telephone bills. His small campaign staff, which had been working without pay for several weeks, was forced to set up a make shift headquarters at the candidate's law office.

But Turnipseed, who had run up an estimated $25,000 in campaign debts, had vowed to remain in the race. "We're glad to be running broke," he said last week. "It's the only way to run in this state, because we're just about the poorest state in the U.S."

Turnipseed, an arm-waving orator who openly admitted that he "used to be a segregationist redneck until I really got to know black people," had chosen the utility companies as his prime campaign targets. He repeatedly lashed out at them for their high rates and for cutting off service to the poor.

He also had pledged to get rid of the current political leadership in South Carolina, and challenged voters in the state to do away with their "archaic, decadent, unresponsive system of government" - an approach that did not endear him to the state's political and economic establishment.

It was unclear yesterday whether Turnipseed's name would be taken off the ballot. Although he has formally filed for the office, state Democratic Party officials say that party rules allow candidates to withdraw for mediately reasons. The party's executive council is to meet week to resolve the question.

Turnipseed's exit from the Democratic primary generally is viewed here as helping state Sen. Richard (Dick) Riley and former congressman William Jennings Bryan Dorn, two of the other three candidates in the race. Riley, who is campaigning as a reformer, and Dorn, who says he too is a populist, may pick up some of Turnipseed's support.

The other candidate in the race, Lt. Gov. Brantley Harvey, is not as likely to benefit from Turnipseed's departure. Harvey, considered to be the front-runner in the contest, has the support of much of the political and business leadership in the state - tee group Turnipseed continually attacked.

The winner of the June 13 Democratic primary will face in November the victor of the GOP primary. The Republican candidates for governor are Raymon R. Finch Jr., a Columbia businessman, and former congressman Ed Young. The current GOP governer, James B. Edwards, cannot succeed himself.