From my experience, it doesn't seem possible at this point. Optional features are not available in the Sandbox as at June 2023.
Legacy .NET Framework such as 3.5 and 2.0 cannot be downloaded and manually installed either.
Hopefully the Windows Sandbox team will fix this in a future update.