wsl::is_wsl() returns true under WSL, false otherwise. wsl::version() returns an WSL version number.
wsl::is_wsl()
wsl::version()