I have a cabin with a metal roof and plywood underlay and want to use compressed Styrofoam to insulate between the rafters.
Do I need a moisture barrier and how would I install this?
The important point is that any an all seams are sealed by the tape to create a water, and air tight seal.
You don't need a moisture barrier, you need an air barrier.
The method you propose can work, but is risky. When you insulate a roof like this, you are making the plywood roof sheathing colder, since the insulation is doing its job of reducing heat loss. Cold roof sheathing can get condensation on it if there is not a perfect air seal and moist interior air can travel through the insulation.
You have two options: Option 1 is to install the foam panels up against the plywood roof sheathing, seal the edges with spray foam, and hope for the best. This will fail with less than perfect workmanship. Option 2 is to install the foam panels offset from the roof sheathing, with a 2+ inch gap between the plywood and the foam, creating an air channel. This will allow any moisture that does condense and build up there to escape. This approach requires openings at the soffits and roof ridge for airflow.
For either approach, once you have the foam boards up and sealed to the framing with canned spray foam, you can stuff the remainder of the rafter cavities with fiberglass or mineral wool batts.