Kodak Black just pled guilty to first-degree assault and battery in his sexual assault case in South Carolina, and he’s been sentenced to 18 months probation … TMZ has learned.

The rapper was originally indicted on a felony charge of first-degree criminal sexual conduct, but his attorneys, Bradford Cohen and Beattie Ashmore, tell us Kodak copped a plea to a lesser charge to put the case behind him.

As we reported, Kodak was charged for allegedly sexually assaulting a teenage girl back in February 2016 at a hotel. According to prosecutors, he pushed the girl into a wall and onto a bed before assaulting her, allegedly biting her breast and neck. Kodak had denied the allegations.

Ed Clements, the 12th Circuit Solicitor in Florence County, tells TMZ … Kodak admitted in court he bit the girl, but apologized to her, on the record.

Kodak Black Performance Photos

We’re told Kodak was given a 10-year suspended prison sentence and placed on 18 months of supervised state probation.

While on probation, he will not wear an ankle monitor, but must let his probation officer know where he goes and where he lives.

We’re also told Kodak will not be allowed to use drugs, drink alcohol or have guns and if he successfully completes the 18-month probation … he won’t spend a day in prison for the case.