Your WSL2 linux system has its own ip address.
You can get its current ip address with this command (on your windows host, with PowerShell or CMD.EXE):
wsl hostname -I
You can now use this ip address in your hosts file (on windows host).
The ip address of your WSL2 system is not static so if you restart your pc your WSL2 host will have a different ip address.