ISTR this is about Windows restrictions on what can be done with files
in the default user Temp directory.
Try setting the TEMP or TMPDIR environment variables to point to another
directory and see if that works around it.
That was the issue I discovered a few weeks ago. Rather than change the TEMP location for the whole system I created an empty C:\Octave\Temp folder, and before a pkg install, in run:
>> setenv('tmpdir', 'C:\Octave\Temp')
And then installation works just fine. You could also add that line to your .octaverc file.
To check current setting:
>> tempdir
ans = c:\Octave\Temp\
Compilation and execution in the user's temp folder is disallowed by some windows security protocols and anti-malware services now. Telling it to compile elsewhere seems to be the easiest solution.