There is no single direct train from Manhattan to John F. Kennedy International Airport. The most common rail route combines the Long Island Rail Road (LIRR) and the AirTrain JFK.
Take the E train (or A train to Howard Beach) to the AirTrain connection. This is cheaper but slower (~60–75 minutes total).
The AirTrain itself loops through the airport in both directions (effectively "uptown" and "downtown" on the loop), so directionality isn't an issue once you're on it.