How does one install a ocaml package that is a tar.gz using opam?

I want coq 8.4pl6 but I can only download it here:

8.4.6

how do I download it with opam?

Coq 8.4.6 is available on opam. Can’t you just do opam install coq.8.4.6 ?

it needs to be 9.4pl6

From looking at your link I’m fairly certain that 8.4pl6 is exactly 8.4.6 from opam.
If you need clarification you should ask on the Coq forums (e.g. https://coq.discourse.group/).