She was laid down as HMS Duff (BDE-20) for the Royal Navy on 15 April 1942 by Mare Island Navy Yard; launched on 21 November 1942; sponsored by Mrs. Bert A. Barr; retained for use in the U.S. Navy and renamed LeHardy on 19 February 1943; and commissioned on 15 May 1943.
After shakedown, LeHardy was assigned to the "pineapple run", escorting convoys from the United States west coast to Pearl Harbor. She sailed on her first cruise to Hawaii on 21 July and made two additional runs with convoys before being ordered to remain at Hawaii in late October. Following training exercises, LeHardy departed Pearl Harbor on 15 November as ASW screen with a convoy en route to Tarawa. Upon arrival there 10 days later, the destroyer escort continued patrol and screening operations with the 5th Fleet in the vicinity of the Gilbert Islands. LeHardy remained off the Gilberts as the U.S. Marines ashore secured the islands, from which the Marshalls operation would be launched.
Departing Makin on 25 December, she steamed back to Hawaii for pre-invasion training in preparation for her next assignment. Sailing from Pearl Harbor again on 28 January 1944, LeHardy formed part of the escort and ASW screen for a convoy to the Marshall Islands landings. She arrived off Kwajalein on 5 February, the day the atoll was secured, then escorted the cargo ships to Funafuti, Ellice Islands. She returned to the Marshalls in mid-February for patrols and screening duties during the capture of Eniwetok, before sailing for Pearl Harbor on 4 March.
Upon her arrival on 11 March, the destroyer escort was assigned to training exercises with fleet submarines. LeHardy continued these operations until she departed Pearl Harbor late in May for ASW operations in the Marshalls. Throughout the summer, she alternated between ASW duties in the western Pacific and training exercises out of Hawaii.
Surrender of the Japanese garrison at Wake Island
From 22 October 1944 until 22 January 1945, LeHardy escorted tanker convoys from Eniwetok to Ulithi, then sailed for a Seattle, Washington, overhaul. The destroyer escort returned Eniwetok on 28 May to resume her Eniwetok-Ulithi convoy runs, her task for the rest of the war. On 2 September, LeHardy departed Kwajalein to take part in the surrender ceremonies on Wake Island. Arriving there on 4 September, LeHardy stood by as the Japanese admiral surrendered the island. A detail from the ship went ashore and raised the pole which once again flew the American flag over Wake Island.