Train/subway takes 1 and 1/2 hours and costs 7 dollars each way ($5 for train and $2 for subway). An $16 metrocard handles both and leaves with with enough for 2 extra subway/bus trips (you get a 2 dollar bonus).
Considering 2 hours lead time at the return to the airport you have 4 hours in the city.
Train/subway takes 1 and 1/2