See the answer to this question: Assigning Managed Package Licenses in a Sandbox
By default, when you refresh a Sandbox of a Production org that has a Managed Package installed with per-user license management, the Sandbox will have a "Site" license to that Managed Package, so you will not be able to assign individual users to that Managed Package -- all users in the Sandbox will have access to that Managed Package.
This can be problematic, though, if you're trying to have different behaviors for users without licenses to the given Managed Package, or trying to prevent the Managed Package's functionality from running unless a user is licensed to that Managed Package.
In this case, if you're not going to be refreshing this Sandbox very often, you can ask the ISV who created the Managed Package and ask them to go into the License Management Application (LMA), find your Sandbox License record, and switch the licensing from the default (Site License) to a per-user licensing model --- this will allow you to assign some users licenses to the Managed Package in your Sandbox while having other users not be licensed. I've done this before at my company so I know this is possible and we've done it before on occasion.