Gilbert Arenas has been "behaving badly" and needs to change ... so says a judge who just ordered the ex-NBA star to attend co-parenting classes with his ex ... TMZ Sports has learned.
Gilbert and Laura Govan -- the mother of his 4 children -- were just in L.A. County Superior Court ... where they've been battling out a custody arrangement ever since their nasty split last year.
But on Monday, the judge admonished Arenas in open court -- saying, "Gilbert is behaving badly. He needs to change."
As we previously reported, Laura has claimed Gilbert is a "reckless parent" -- and was furious after he posted a video of their 8-year-old son dangerously riding on the front hood of a Polaris back in December.
The hostility between Laura and Gilbert goes back way further than that -- but on Monday, the judge told them they NEED to learn to get along for the sake of the kids and ordered them to 12 hours of co-parenting classes, which must be taken together.
If they don't complete the classes, the judge could alter the arrangement again -- affecting everything from Gilbert's financial obligation to visitation.
They're due back in court in July -- giving them 6 months to figure things out.
Good luck ...