McAllister, the first Scot to appear on the BBC television show, has been given six months to obey court orders in a child contact case or face being heavily fined or sent to prison.
The bill for court costs was imposed after a sheriff ruled she had repeatedly wasted court time.
Sheriff Fiona Tait rejected a plea at Perth Sheriff Court by McAllister's lawyer Kevin Murphy to let her escape without any punishment by admonishing her.
Sheriff Tait said: "This was a particularly bad contempt of court."
She continued the case until December after hearing McAllister had started co-operating with the court ruling over child contact.
The court heard there had been a number of issues between McAllister and her son's father that had prevented contact being maintained without incident.
McAllister, who now lives in Hitchin, Hertfordshire, was ordered to pay £20,000 back to the Scottish Legal Aid Board.
Sheriff Tait cut the bill from £24,000 to £20,000 after being told McAllister paid a £1400 a month mortgage on a second home, which she lets her parents live in rent free.
McAllister told the court she had less than £300 in the bank but then admitted her second home at Forest Mill, Clackmannanshire, had been valued at £385,000.
She was found guilty of contempt after defying court orders to hand her son over to his father for contact on a number of occasions.
Sheriff Tait warned her that if she did it again she could be sent to prison and deferred sentence for six months for good behaviour.
Sheriff Tait told McAllister: "The options are a custodial sentence, a financial penalty or for the court to defer matters.
"I'm minded to defer sentence for six months for you to be of good behaviour and show you will obtemper (comply) to an order made by the court.
"The sentencing options will remain live to the court for that six-month period. What I want is no further repetition of your failure."
McAllister was given legal aid to defend the civil action by her former partner and the case had been called in court on more than 30 occasions over the past four years.
Sheriff Tait ruled significant costs had been incurred by McAllister wasting court time. She said the ex-TV contestant had been a drain on "public funds".
"Court days were allocated and lost. A morning was disrupted. I have had regard to her conduct and am satisfied that not only is that conduct rightly subject to criticism, but it has also resulted in unnecessary expense."
Scottish Legal Aid Board solicitor Scott Cownie told the hearing McAllister had cost the taxpayer "tens of thousands of pounds".
McAllister featured in the second series of the BBC show, fronted by Lord Sugar, but was told "You're fired" midway through the process.
She has since been involved in a number of projects, including the setting up of an internet TV company and a baby gifts company.
The court was told McAllister had been working for a college but had lost that job.
Her former partner said: "There were plenty of opportunities for us to get around the table. It's almost like her pride gets in the way - she can't possibly be seen to lose."