Fresno Yosemite International Airport: Rent a car at the airport; Ahwahnee is roughly 1–1¼ hours via CA-41 to Oakhurst, then CA-49. This is the sensible fly-in option: it is the closest substantial airport and avoids a long Bay Area drive. There is no useful airport-to-Ahwahnee public-transport transfer.
Merced Airport / Merced Amtrak station: Merced is useful only if you are connecting from Los Angeles, Sacramento or the Bay Area by rail. Rent a car in Merced for the roughly 1½-hour drive to Ahwahnee. YARTS serves Yosemite via Highway 140, but it is not a practical direct connection to this small foothill community.
San Francisco International Airport: Use SFO only for a much better airfare or international routing, then rent a car. Allow about four hours without Bay Area rush-hour traffic, longer on Friday afternoons and summer weekends. Oakland (OAK), San Jose (SJC), Sacramento (SMF) and Reno (RNO) are similarly car-dependent alternatives; Reno only makes sense when Tioga Pass is open.