ALLEN PARK, Mich.—A crew of engineers slipped past the empty security gate at a Ford Motor truck plant outside Detroit just after 3 a.m. The factory lines were still at that hour—but that was the point. The crew was there to test a section of a new pickup that few at the company knew even existed. Ford’s secret project had an ambitious goal: to figure out how to make electric vehicles in the U.S. that could compete with the Chinese models clobbering competitors globally. The secret is now out as Ford races toward building its first model, a new truck…