T-Mobile does not offer this feature. If it is available to you, it would be through a third party application.
Would you mind providing a few details that could help us provide some options? Is this a phone you're handing off to someone occasionally, and you want the internet locked at that time? Or a phone that's being used by someone consistently who you don't want to have internet access? What specific device is it? Looking forward to seeing what we can come up with!