An optimal upper bound for the dilute Fermi gas in three dimensions