NEW YORK — The bong-toss case against Amanda Bynes will be dismissed if she stays out of trouble for six months.

A Manhattan judge on Friday allowed the adjournment in contemplation of dismissal, which means the actress does not have to admit guilt. She must attend counseling twice a week for six months.

The “Hairspray” star didn’t appear in court. An affidavit said she understood the agreement.

She was charged last spring after officers said she heaved a bong out the window of her 36th-floor apartment.