Former Nickelodeon star Matthew Underwood -- who played Logan Reese on "Zoey 101" -- has learned the hard way ... weed and underage women are a bad combination.
According to WPBF25 in Florida, 22-year-old Underwood was in a bedroom with a 17-year-old girl in Port St. Lucie when cops arrived to the scene and discovered marijuana and weed paraphernalia.
Underwood was arrested on possession of the sticky icky ... as well as contributing to the delinquency of a minor.
Underwood was transported to a nearby jail -- where he was booked and released. Now here he is on "Zoey 101," ripping off a stuffed giraffe head.