A Metropolitan Police officer admitted saying a black man looked like a monkey but said he was discussing evolution.
PC Kevin Hughes, 36, of Brentwood, Essex, is also accused of saying black people were "more closely related to Neanderthals", but said he did not know what the word meant.
Hic colleague, PC David Hair, 42, of Epping, Essex, is accused of saying a black woman colleague might "go home to cook bananas".
Both deny making racist comments.
The officers, who were suspended from the Met on 5 April, are each charged with using threatening words or behaviour, and racially-aggravated harassment.
PC Hughes said he made the comments because he saw a black man with "elongated arms" and a "gait" like a monkey while out on patrol with three colleagues in Newham, east London, Westminster Magistrates' Court heard.
He said on 22 February he and PC Costas Dakoutros were having an argument about evolution and he pointed out the man in the street to illustrate his point.
He said part of the motivation for saying it was remembering school textbooks depicting apes evolving into men.
He acknowledged the use of the word "chimpanzee" but said he did not know what Neanderthal meant.
Asked by prosecutor Kate Wilkinson if he was restricting his comparison to "black people", he said: "It is upsetting for someone to say that about you. It is just ridiculous."
PC Hair is alleged to have suggested on 13 March that his colleague PC Julia Dacres might be unable to work overtime because she had to "go home to cook bananas".
PC Hair's lawyer Guy Ladenburg put it to PC Dacres that his client's comments were merely "jocular".
"If David Hair had said you were going to eat pizza or steak there would not have been an issue would there?" Mr Ladenburg asked. He said PC Hair was not being aggressive.
PC Dacres said: "It wasn't aggressive but he was trying to get a rise out of me with the overtime (comments). I don't know whether in your eyes that would count as banter."
PC Kirk Baker, who was driving the car when PC Hughes made his comments, was asked by Ms Wilkinson if he had heard anything like it in his 10 or so years as a police officer.
He said: "That has (happened) with members of the public, people I arrested, that sort of attitude. I have never experienced it with another police officer. It is different to deal with it from a member of the public. I was not expecting it from a work colleague."
The case continues.