The 44-year-old TV pundit asked the officer if he was being arrested because he was black, accusing the police of racism before urinating in a police car, Blackpool Magistrates' Court heard.
Sinclair continued being racist after he was taken to the cells at Blackpool Police Station, and used a racial slur against the officer, it was also told.
Former Blackpool starlet Sinclair, who lives in a Â£500,000 home on Victory Boulevard, Lytham, pleaded guilty to drink driving and a racially aggravated public order offence last November.
Nick Freeman, representing Sinclair, said the 'catalyst' for his behaviour was being subjected to racism in front of his family while out having a meal hours earlier.
Mr Freeman said a woman approached the father of four, patted him on the head, and called him a 'little chocolate man'.
After Sinclair's guilty pleas, the prosecution dropped other charges, including assault on a police officer, failing to provide a specimen, and criminal damage.
Sinclair, who scored 15 goals in 112 appearances for the Seasiders from 1989 to 1993, was sentenced to 150 hours' community service for the racially-aggravated public order offence, and given a 20-month driving ban for drink-driving.
District Judge Jeff Brailsford told him: "What happened that night was not the real Trevor Sinclair.
“You have worked long and hard to eradicate racism; racism you must have suffered as a player.
“You have also expressed genuine remorse.”
The winger, who played in the Premier League and at the 2002 World Cup, retired in 2008 and worked as a pundit, including on Match Of The Day, though the court was told his TV career could now be over.
Jim Mowbray, prosecuting, told the court police were alerted to an incident at Sinclair's home address at around 8.45pm on Sunday, November 12, but were told he had left in his Tesla car and may have been drinking.
Patrols sent to look for him found his car stopped in the middle of Clifton Drive after Sinclair collided with a woman, who stepped into his path after getting out of a taxi, the court heard.
In a statement read to the court, PC Gareth Evans said: "I asked Mr Sinclair what had happened. It appeared to me he was drunk, unsteady on his feet and his eyes were glazed."
Sinclair was given a roadside breath test and found to be twice over the drink-drive limit, giving a reading of 72 micrograms of alcohol per 100 millilitres of breath. The limit is 35mg.
"Yes, I am probably over the limit," the ex-footballer said before being arrested, when his behaviour changed, the court heard.
PC Evans' statement continued: "Before his arrest he was very calm, polite and courteous.
"He started asking if it was because he was black. Black people are under-represented in the police.
"He started getting more confrontational, he was getting more aggressive.
"I did not like the direction the conversation was going in. He was accusing me of being racist.
"He began to become more agitated and aggressive."
During the search, the officer found Sinclair's trousers were wet, and that he had urinated while sitting in the police car, the court was told.
When Sinclair was put in the back of the police van, he called the officer a 'white c***' as the van doors slammed shut, the court also heard.
Sinclair made further racist comments while in the back of the van and continued to be 'obnoxious, aggressive and racist while being booked in', magistrates were told.
PC Evans' statement added: "Sinclair's behaviour following his arrest was awful. I'm not a racist. His behaviour was extremely racist."
Celebrity lawyer Mr Freeman said: "He had been out for a family meal and at a bar on his way home a woman called him her little chocolate man and rubbed his head.
"This appears to have been a catalyst and he was extremely upset.
“He got back home and was upset by the attitude of some of his family to that remark and needed to get out.
“There was an accident but it was a no fault accident. The woman stepped into his path and he stopped and showed concern for her.
“He had taken alcohol and he should have kept his views to himself. After all he is an active member of Show Racism The Red Card, which wants to kick racism not just out of football but in general.
“As a result of his arrest, he suspended himself from his work as a TV pundit, and that may well have a terminal effect on his TV career.”
Details of Sinclair's charity work were given to the judge and a character reference from Professional Footballers’ Association (PFA) boss Gordon Taylor said the PFA would offer Sinclair counselling if he needed it.
Mr Taylor told the court the former midfielder is 'highly respected and finds racism abhorrent.'
Sinclar was also ordered to pay Â£500 compensation to PC Evans and Â£170 court costs.
Show Racism The Red Card, which campaigns to tackle discrimination in football, has been contacted for a comment.
A BBC spokesperson said: “He [Sinclair] is a freelance broadcaster. We currently have no scheduled plans to use him on our programmes.”
Lord Herman Ouseley, chair of Kick It Out, a charity similar to Show Racism The Red Card, said: "There is too much racism across society currently, with it being even more regrettable and unacceptable when it is perpetrated by individuals who should know better. Trevor Sinclair has accepted personal responsibility for his failings in this regard.
“Trevor has proved to be a popular and successful role model in the past for the next generation of football players and supporters, and will no doubt wish to take the necessary steps to ensure that he never abuses again.
“Kick It Out would offer support and guidance to any individual or organisation which seek reform through training on matters of equality, inclusion and cohesion.”