Bam Margera won't be sentenced to a single day in jail for his hotel trespassing case ... if he successfully completes drug treatment, but he's not getting off scot-free.
The troubled "Jackass" star cut a deal with L.A. prosecutors ... allowing him to dodge time behind bars. Bam pled no contest to 1-count of trespassing for his August arrest ... when he refused to leave the Luxe Hotel.
However, there are a couple of conditions to the deal. The judge sentenced Margera to a 90-day controlled substance treatment program, and he's been ordered to stay away from the hotel during his probation period.
As for that probation ... the judge ruled Bam's trespassing arrest violated his probation from his DUI case last year, and as a result, hit the reset button. That means he's staring down a fresh 3 years of probation.