HAWTHORNE, Calif. — NASA Administrator Jim Bridenstine stopped by SpaceX’s headquarters here Thursday. He toured the factory with SpaceX founder Elon Musk, took a spin in a spacecraft simulator, then met with the media afterward, smiling for the cameras.

But this was no social visit.

He came, he said in an interview afterward, to get a detailed briefing on the progress of one of the highest-profile programs the space agency has going — the construction of a capsule that would help NASA restore human spaceflight from American soil after an eight-year hiatus — and to make a public statement that he would hold contractors accountable, after several key programs have suffered years of schedule delays and cost overruns.

It was a long scheduled visit, but one that suddenly had a different dynamic after Bridenstine publicly chastised SpaceX as it was preparing to unveil a next-generation spacecraft known as Starship to take people to the moon and Mars. At the time, Bridenstine was frustrated that the company appeared to be spending a lot of time and energy on developing Starship, when it was behind on building the capsule to ferry NASA’s astronauts to the International Space Station under what’s known as the “commercial crew program.”

On Twitter, Bridenstine took a shot at the company, saying NASA “expects to see the same level of enthusiasm focused on the investments of the American taxpayer. It’s time to deliver.”

It was an unusual move for an administrator to call out a single company at a time when the agency has so many programs, including a gigantic rocket that NASA is building, suffering significant problems. But in an interview after the tour, Bridenstine said that he is confident now that SpaceX is focused on the task at hand.

“I think probably a couple of weeks ago we were not on the same page,” he said of NASA and SpaceX. “But now we are 100 percent.”

It wasn’t the first time Bridenstine was miffed at the company and its chief executive. Last year, he ordered a safety review of SpaceX and Boeing, the other company under contract to fly astronauts to the station. Those assessments, which are underway, were prompted by Musk’s taking a puff of marijuana while appearing on a show broadcast on the Internet.

“If I see something that’s inappropriate, the key concern to me is what is the culture that led to that inappropriateness,” he told The Post then. “As an agency, we’re not just leading ourselves, but our contractors as well. We need to show the American public that when we put an astronaut on a rocket, they’ll be safe.”

On Thursday, he said he was interested in making progress, not friends, and wouldn’t mind ruffling feathers.

“I don’t know that bonding with the CEO of a corporation that is a contractor to NASA is something I would be interested in doing now,” he said. “At this point I have a fiduciary responsibility to the American taxpayer.”

In 2014, NASA awarded contracts, worth $6.8 billion combined, to SpaceX and Boeing to design spacecraft capable of flying astronauts to the International Space Station.

The program has suffered a series of setbacks and delays — as well as restricted funding from Congress that has delayed the first flights, originally scheduled for 2017.

Last year, during a test of its abort system, Boeing’s Starliner spacecraft suffered a propellant leak after four of eight valves failed to close properly. The investigation and remediation efforts resulted in a one-year delay, according to the Government Accountability Office.

Boeing hopes to fly its capsule later this year in a test flight without humans, ahead of flights with crews next year.

SpaceX has already successfully completed its test flight without crews on board. But shortly after the flight, its Dragon capsule exploded as the company was testing the engines of its emergency abort system.

Talking to reporters after the event, Musk said the company has fixed what caused the explosion and that the point of a development program was to discover problems before flying astronauts.

“If there’s a test program and nothing happens in that test program, I would say it’s insufficiently rigorous,” he said. “If there hasn’t been hardware that’s blown up on a test stand, I don’t think you’ve tested it hard enough. You’ve got to push the envelope.”

He also pointed out that the spacecraft that was destroyed was the same one that had successfully docked with the space station in the test flight. “If people had been on board,” he said, “they would have returned safely.”

He said that SpaceX is committed to making sure “we’ve done everything possible to ensure the astronauts will be safe. Only at that point will we launch.” And he said that developing the Dragon spacecraft “is absolutely the overwhelming priority” and that the company has “a lot of people working super hard” to make it happen.

Still, it’s clear the company has a way to go before that day. It’s working on a new parachute design that will have to undergo more testing. It also has to test the spacecraft’s emergency abort system during a launch.

In the end, Bridenstine said he has confidence in the company.

“We will make it,” he said. “This is a big deal for our country. We can’t get it wrong.”