In Microsoft Teams admin center > Users > External access, have a look at sections Teams and Skype for Business users in external organizations (block some or all external domains) and Teams accounts not managed by an organization, these might be what you are looking for.
Please accept as an answer if this was helpful.