Login problems as usually due to your account being the default used by the browser. We can try a few things.
1) Go to Outlook.com and log out of any accounts you're logged in to. Shut the browser completely, including all of the tabs.
2) Go to Office.com and log out of any accounts you're logged in to. Shut the browser completely, including all of the tabs.
At this point you should be logged out of any Microsoft accounts. However, if you're using Microsoft Edge and you're logged into Windows with an online account, it may assume your identity. You can avoid this by using Google Chrome, or another browser.
Now try to accept the invite and log into Sandbox.
If it is STILL assuming your identity, something must be cached in the browser you're using. Sandbox should tell you which account it's trying to use to log in if it fails.
You can clear the browser cache of all saved passwords/accounts you may have cached. Instructions for this vary by browser and are readily available online.
This is showing that I have 2 active microsoft accounts logged in and I can either select one of them to use while logging in, or I can click "Use another account" to add an alternate.