Did it ever worked before, or is this the first time you set this up?
If it is the first time, please follow THIS link to setup Guest Access as AD and Sharepoint needs to be configured as well.
Example places below where configuration needs to be done:
Azure AD B2B External Collaboration
Teams guest access settings
Microsoft 365 Group guest settings
SharePoint Org level sharing settings
SharePoint Org level default link settings
SharePoint site-level sharing settings (first create new Team, or update existing team site)
Let me know if this helped you
Please mark this message as "Accepted Answer" when your question is answered which helps users to know the answer solved your question/issue.
Thanks in advance
Kind Regards,
Mitchell Bakker