You cannot determine this from just the year and model. Look for a tag on the transmission itself or check your owner's manual. The manual will specify the correct type and amount of fluid.
Manual Transmission (M5OD-R2): If you have a manual transmission, it will generally require a 75W-90 GL-3 or GL-4 gear oil. However, always check your owner's manual for the exact specification. Using the incorrect oil can severely damage your transmission.
Automatic Transmission (4R44E or 4R55E): Automatic transmissions require *transmission fluid*, not gear oil. These transmissions use a specific type of ATF (Automatic Transmission Fluid). Do NOT use gear oil in an automatic transmission. Again, consult your owner's manual for the exact recommended ATF type and specification. Ford typically specifies their own brand of ATF, but compatible fluids from other manufacturers may be available.
In short: Find your owner's manual. It's the only reliable way to know the correct fluid for your specific 2001 Ford Ranger transmission. Using the wrong fluid can lead to expensive repairs.