The May 2023 VSCode 1.79 can also update that setting for you through a confirmation dialog.
See "Windows UNC host allowlist improvements":
As part of an important security fix, VS Code introduced an allowlist for UNC hosts.
In this milestone, we addressed many of the usability problems reported by Windows users when they have UNC paths in their day-to-day work with VS Code.
Dialog improvements
The confirmation dialog to allow a UNC host on startup now updates the security.allowedUNCHosts setting and adds the host when you select the checkbox.

In addition, clicking the Learn More button no longer closes the dialog.
New security.restrictUNCAccess
setting
A new setting security.restrictUNCAccess
lets you disable the UNC allowlist for hosts and restore the behavior to how it was before this security fix.
We strongly advise against changing this setting, as it makes your system vulnerable again to the Information Disclosure Vulnerability.