A man told a GP "you should go back to where you come from" after being refused medication.
Thomas Boyes, aged 38, was informed that his registration was not complete at the surgery, provoking him to make the comment.
Teesside Magistrates' Court heard how the incident took place at the The Coatham Surgery in Redcar, as reported by Teesside Live.
Prosecutor, John Garside, told the court how Boyes was told to go back to his original surgery to request it.
He stated that Boyes then proceeded to make racist remarks towards a doctor who was working at the practice.
Mr Garside: "It was explained to him he wouldn't be able to have the medication.
"The defendant has said 'where are you from?' followed by 'you should go back to where you come from'.
"He said he was not racist but made comments as discussed because he is a Christian."
The court in Middlesbrough heard how the incident left the victim feeling unsafe and unwelcome.
Mr Garside said: "It makes him feel he's not welcome in his own town."
Boyes pleaded guilty to racially/religiously aggravated intentional harassment/alarm/distress at The Coatham Surgery on June 8.
Helen Sabiston, defending, told the court: "It's a very unfortunate incident to say the least.
"Mr Boyes had been having a significant number of difficulties in the earlier period of this year.
"It's quite clear he went to the surgery to try and order some medication."
She said he had moved into the Redcar area for a period and went to the local surgery.
Ms Sabiston said: "His mental state was such that he reacted in an adverse fashion."
She said Boyes had mental health difficulties which were so severe that he was sectioned at Roseberry Park for three weeks in May.
His solicitor said this incident happened not long later in June and that he has been diagnosed with bipolar.
Ms Sabiston said: "That is not an excuse and Mr Boyes knows that's not an excuse but it perhaps explains why his record shows a number of similar incidents in the beginning of this year,."
She added that Boyes, who is in receipt of benefits, was now a "completely different person" to the one she met earlier this year.
Chair of the Bench Katherine Evans told Boyes: "We have taken into account you already have a community order in place.
"You also have support with your mental health issues. We are therefore going to fine you for this offence."
She told the defendant that they would give him credit for his guilty plea.
Boyes was fined £216 and ordered to pay £85 costs and a £34 victim surcharge.
Don't miss the latest news from around Scotland and beyond - Sign up to our daily newsletter here.