Mayor Bill de Blasio and Scott Stringer at a finance meeting in July. Zuma Press

New York City Comptroller Scott Stringer has long pushed for the government to expand its use of solar energy. But when Mayor Bill de Blasio unveiled a new solar initiative at a city school last month, Mr. Stringer wasn’t there for the announcement.

He wasn’t invited.

Relations between two of the city’s most powerful Democrats have been frosty since August, when the comptroller accused the de Blasio administration of failing to submit pre-K contracts for review, putting a damper on the rollout of the mayor’s top campaign issue.

Messrs. Stringer and de Blasio haven’t spoken since an Aug. 27 closed-door meeting inside the mayor’s City Hall office, people familiar with the matter said. At that meeting, Mr. de Blasio tried unsuccessfully to dissuade Mr. Stringer from going public with his concerns about the pre-K contracts, said people familiar with the conversation.

The rift underscores Mr. Stringer’s willingness to be among a small circle of Democrats who question the mayor. Mr. Stringer and his aides maintain that the comptroller’s criticisms have been valid and reflect his responsibilities as the city’s chief financial officer.

Mr. Stringer’s critical stance has contrasted with that of other city Democrats, including Public Advocate Letitia James, who counts the mayor as an ally and frequently appears by his side.

In an interview on Thursday, Ms. James suggested Mr. Stringer’s criticism might be politically motivated. Mr. Stringer initially planned to run for mayor in 2013 and hopes one day to succeed Mr. de Blasio as mayor, people close to him say. Ms. James has said she isn’t interested in running for mayor, but some suspect that might change.

Ms. James said she, the mayor and the comptroller were “politically and philosophically on the same page” before last year’s election. Now, she said, “there seems to be a chasm.”

“I question why the ground has shifted,” Ms. James said. “I question some of the critiques.”

Asked if she believes the comptroller’s criticisms were based on principle, she replied, “The jury is still out on that.”

Ms. James said she doesn’t believe in creating “artificial disagreements” with the mayor.

New York City has a history of mayors and comptrollers clashing, the most recent examples being Mayor Michael Bloomberg and Comptroller John Liu. The comptroller is responsible for safeguarding the city’s fiscal health and rooting out government fraud and waste.

“Scott is a person that always tries to do his job as he sees it and doesn’t take unnecessary, random shots at the mayor,” said George Arzt, a Democratic consultant who has worked with both Messrs. Stringer and de Blasio. “They would never, ever go public unless they thought they were right.”

Last winter, Mr. Stringer criticized Mr. de Blasio for calling a high-ranking police official when a political supporter was arrested. In the spring, the comptroller accused the administration of violating accounting principles in the mayor’s first major labor settlement. The administration ultimately acquiesced to Mr. Stringer’s demands.

More recently, Mr. Stringer accused the mayor of usurping his authority to investigate living-wage regulations. (The mayor and his aides said the allegation wasn’t true.) Mr. Stringer also issued a report criticizing the lack of diversity among the city’s vendors. (The mayor’s aides called the report’s methodology faulty.)

But none of these skirmishes appears to have rankled the mayor the same way as the criticism about the pre-K contracts.

On Aug. 27, days before the launch of the mayor’s prekindergarten initiative, Messrs. de Blasio and Stringer spoke by phone about the comptroller’s concern that the administration hadn’t submitted contracts for vetting by his office. The mayor called the complaint bureaucratic and lacking in substance.

The phone call didn’t resolve the matter, so Mr. de Blasio requested Mr. Stringer come to his office for a face-to-face meeting. The budget director, a top Department of Education official and the mayor’s intergovernmental affairs director were in the room, a sign of how serious the mayor was taking the issue.

According to a person familiar with the conversation, the mayor appealed to the comptroller not to raise the matter publicly. The mayor assured Mr. Stringer that his administration had done due diligence and that he was ultimately accountable, the person said. The mayor was incredulous when Mr. Stringer—whose office had been trying to work out an arrangement for months—wouldn’t back down, the person said.

Another person familiar with the meeting described Mr. de Blasio as confused and perplexed, not incredulous. The mayor wanted a seamless first day of pre-K and offered to do a joint news conference with Mr. Stringer about his concerns and the city’s response, but that was rebuffed, this person said.

Hours later, the comptroller issued a news release, surprising the administration.

First Deputy Comptroller Alaina Gilligo defended her boss. “We are doing the job of the comptroller—we have to do the accounting, we have to evaluate the budget, we have to register and review contracts,” Ms. Gilligo said. “It’s the work of the office.”

Asked last week about his relationship with Mr. Stringer, Mr. de Blasio said, “This is never about personalities.”

“I don’t worry about political dynamics,” he said.

A spokesman for the mayor said there are “always bumps in the road enacting big change.”

Mr. Liu described Mr. Stringer’s criticisms as “responsible and warranted.” The mayor’s response, he said, was predictable. “Every mayor in New York’s history would have liked to have fired the comptroller on multiple occasions,” he said, “which is why the people in their collective wisdom decided, a long time ago, the comptroller should be separately elected.”

Write to Michael Howard Saul at michael.saul@wsj.com