"It was my opinion that he had such low self esteem that he was ashamed of his skin colour and that is why he referred to himself as a n***** and that is why I repeated it."
The police officer insisted he wanted Mr Demetrio to be "proud" of his skin colour.
He added: "I accept that it was a poor choice of word and I shouldn't have used it. My message was to encourage him to be proud of himself."
A trial last week failed to reach a verdict and a retrial was ordered.
But today a second jury failed to reach a verdict at Southwark Crown Court - and MacFarlane was found not guilty at the judge's direction.
Judge Michael Gledhill said that in his opinion MacFarlane had suffered a "momentary loss of judgement".
He said: "It is in my view that a momentary loss of judgement led the defendant to use that word.
"The word Mr MacFarlane used was said in the heat of the moment.
"It came after the complainant was angry and aggravated with what happened at the hands of another officer when this defendant was not present.
"What was said by the defendant was said immediately after very abusive language was used by the complainant to him.
"Immediately having said the words, which should never have been used, Mr MacFarlane realised what he had said and that he should not have said it. He tried to undo the damage of what he had just said.
"That is my view of the situation and it would be my suggestion that no disciplinary proceedings are launched."
He ordered a formal not guilty verdict be returned.
Prosector Atkinson said: "Only in the most exceptional cases is a third trial set. It is not in the public interest to seek a retrial in this case."
In a police interview the PC admitted getting into a "slanging match" with Mr Demetrio and said the suspect had also called him names.
"I have to confess it became a bit unpleasant," he said.
He added he had previously told other black youths not to hide behind their skin colour before and had a "positive response."
Giving evidence Mr Demetrio said he felt "shocked" and "violated."
"I thought that's it, it can't get any worse than that," he added.
Mr Atkinson said PC MacFarlane used the words deliberately to cause "distress and insult" and suggest Mr Demetrio was inferior because he was black.
But officers, including a black colleague of PC MacFarlane, gave evidence on his behalf that he was not a racist.