Please follow below tips to troubleshoot the issue.
1.Enable external sharing in the tenant level. Go to SharePoint admin center -> Polices -> Sharing -> Set Anyone in the Content can be shared with section.
2.Enable external sharing in the tenant site level. Go to SharePoint admin center -> Sites -> Active sites -> Select the site -> Sharing -> Set Anyone in the External sharing.
3.Go to Site permissions -> Change how members can share -> Set Site owners and members can share files, folders, and the site. People with Edit permissions can share files and folders. Make sure you at least in the members group for the site collection.
4.Go to Site permissions -> Change how members can share -> Trun off Allow access requests.
5.Go to Site Settings -> Site collection features -> Deactivate Limited-access user permission lockdown mode feature.
After checking above tips, go to Site permissions -> Share site only -> Grant external user access to site collection.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.