EXCLUSIVE

The "Django Unchained" actress who was handcuffed after allegedly having sex with her boyfriend in a car has copped a plea ... and part of the deal is apologizing to the officer she accused of racism.

Daniele Watts pled no contest to disturbing the peace and in return the lewd conduct charge was dismissed.

Watts and her boyfriend were in a car outside the CBS Studios in the San Fernando Valley last September when people in a nearby office building called cops to complain they were having sex in the car.

When LAPD Sgt. Jim Parker asked Watts for her ID.... she claimed she was targeted because she's an African American with a white boyfriend and went public with her outrage. When she refused to cooperate she was handcuffed.

But TMZ obtained an audiotape of the encounter, and you hear Watts play the race card and the "I'm an actress" card almost from the get-go.

Watts and her boyfriend must each do 40 hours community service and write apology letters to Sgt. Parker and two other officers.

It's vindication for Sgt. Parker, who was angry when Watts made her initial racism claims.