I had the same problem when opening a solution from a client. Their projects relied on Nugets from their Azure DevOps repo and everytime Visual Studio would try to restore those packages during build I'd be hit with the login popup forever. I had access to their DevOps, I could log in and read and edit bug reports and everything looked great, except VS2022 wouldn't have it.
I tried all sorts of account logout/login in VS2022, I switched to the system web browser and whatnot, but nothing helped. Until finally: In the VS build output the Nuget restore would complain about that remote package config, providing me with the exact .json URL. Following that link took me to a slightly different DevOps login, with more error messages. From there I logged out (again) and logged in again, which this time required the customer's 2-way authentication. After that, VS 2022 stopped asking and everything worked fine.
Apparently you can be logged in to DevOps in multiple ways at the same time, using the same account, and some login can remain while you log out everywhere else. The Visual Studio login prompt apparently can target the "wrong" login. Azure DevOps is a mess.