At T4 go to Airtrain on third level and take the Airtrain marked Jamaica Station. At Jamaica Station transfer to the E subway to 42nd St./Port Authority. When you exit Airtrain you will purchase your Airtrain/Metrocard at one of the self-service kiosks to pay for both Airtrain and subway. There are nice folks there to help you.
At T4 go to Airtrain on