This is in Photoshop CC 20, but I’m sure it will work across other versions also.
First, select all the files that you want to stack, align and then create the end result image by averaging all. Drag them to PS, to open all in the workplace.
Then, go to File > Scripts > Load Files into Stack
Now, click Add Open Files, and be sure to select the option Attempt to Automatically Align Source Images and Create Smart Object after loading Layers, this will create a new document with a Smart Object with all the images layered and aligned, and we’re almost done.
Click OK, and wait until the processing is done. It can take a while depending the number of files to stack (and the processing capabilities of your computer).
The go to Layer > Smart Objects > Stack Mode > Mean. Again, wait until processing is done.
If all went well, you should have your new image. For this example, my final image is this one: