The Scots-born MP for Bradford West, who was expelled from Tony Blair's Labour Party in 2003, said he would prefer "a real Labour prime minister of the whole of Britain" but said he would "fancy being prime minister of Scotland" if it votes for independence on September 18.
Mr Galloway was in Edinburgh for the latest date in his "Just Saw Naw" speaking tour.
His appearance was met by rival protests by the left-wing Radical Independence group, which opposes his pro-union stance, and the right-wing Scottish Defence League, which opposes his links with religious minorities.
The two sides were held apart by police outside Edinburgh's Assembly Rooms, with Radical Independence taunting the SDL with "Nae Nazis" chants, and the SDL calling Mr Galloway "a traitor".
Speaking ahead of his appearance, Mr Galloway said: "I would fancy being prime minister of Scotland but I would rather we had a real Labour prime minister of the whole of Britain.
"I want to avoid the break-up of the country which I think will beggar people on both sides of the border, will lead to permanent Tory rule in Westminster and thus the Bank of England which will control the Scottish economy.
"Unleashed will be a race to the bottom with England cutting taxes, regulation, public spending, and Scotland having to follow it.
"So everyone on both sides of the border will be worse off."
Mr Galloway took to the stage to the strains of Stealers Wheel's Stuck In The Middle With You, saying he chose the song for its chorus "clowns to the left of me, jokers to the right".
"Flag wavers don't like me very much, whether they're Saltire flag wavers or Union Jack flag wavers," he said.
"That's fine. There are a small number of Union Jack wavers who are opposed to my stand on war and occupation abroad, and my identification with religious minorities that they hate.
"If they weren't protesting against me then I think I would be doing something wrong."
Mr Galloway said he believes in "united countries" including a united Ireland, saying he would support Northern Ireland's exit from the UK, in contrast to his bid to prevent Scotland from leaving.
"I don't believe in breaking countries up as I think we have too many countries in the world, not too few," he said.
"The Irish people were denied their right to unity and independence. The Scottish people never have been, and could have voted for independence at any time that they liked in the whole era of universal suffrage of nearly 100 years.
"People say that they want Scotland to have self-determination but they have self-determination, and always have, and will exercise that self-determination again in September.
"If it chooses to become independent then it will become independent, but I think it would rue the day."
He said he would contemplate becoming an MP of an independent Scottish Parliament in the "hypothetical" event of Yes vote.
He added: "I am confident that the vote will be No, and I just want to make sure that it's a decisive result because otherwise the kind of hatred and division that this campaign is at risk of sowing will be a permanent feature of Scottish politics and public life."
Pat Smith, secretary of the Edinburgh Radical Independence Campaign, said: "Tonight's protest is about showing that another Scotland is possible, one where racist, Islamophobic views like those perpetuated by the SDL have no place and where George Galloway's cavalier attitude to politics is a thing of the past.
"Galloway's celebrity status may bring attention to his bizarre and often sectarian brand of unionism, but we know that people in Scotland will see straight through this attempt to feign interest in the referendum as simply another bout of self promotion.
"The Radical Independence Campaign offers a real alternative to the corruption and self-interest of Westminster politics which Galloway seems so comfortable with. We want to see a Scotland run for and by the people - a people's democracy, a society of equality, a great welfare state, a good neighbour, and pioneer of a just economy."
Mr Galloway faced robust questioning from the Edinburgh crowd, with a large contingent of nationalists fielding questions and applause from a sizeable section of the audience to Mr Galloway's unionist retorts.
He said Scotland would have been "totally bankrupt" like Iceland if it had been independent during the banking crisis that threatened its two biggest banks, the Bank of Scotland and the Royal Bank of Scotland.
One audience member said: "Do you know what happened in Iceland? They jailed the bankers and refused to pay the debt. That's what needs to happen here. We need bravehearts, not faint hearts."
Mr Galloway said: "Are you all Marxists? Are you all going to refuse to pay the debt? Do you think anyone will ever lend you money again?
"This is ultra-left madness. If I thought Scotland was on the verge of a Leninist revolution I would move back here but it isn't."
He added: "If you think that after independence Alex Salmond is going ditch the Queen, leave Nato, break with the pound and refuse to pay the debt once you've voted him in you've got another thing coming.
"Stop pretending Tommy Sheridan is going to be the prime minister of an independent Scotland.
"The prime minister is going to be Alex Salmond, and then it will be Nicola Sturgeon: Mrs Thatcher in a kilt."