PARIS — Two centrist allies of President Emmanuel Macron of France left the government on Wednesday, clouded by allegations that their party had misused European Union funds.

The resignations of the two officials — François Bayrou, the justice minister, and Marielle de Sarnez, the minister for European affairs — cast a shadow over what was supposed to be a minor cabinet shuffle later on Wednesday. A day earlier, Sylvie Goulard, the defense minister, announced that she would step down.

Mr. Macron’s prime minister, Édouard Philippe, announced the formation of a new cabinet on Wednesday, after legislative elections on Sunday that gave Mr. Macron and his centrist allies a decisive majority in the National Assembly, the lower house of Parliament. Florence Parly, a senior executive at the French national railway company and a former Socialist junior budget minister, replaced Ms. Goulard as defense minister. Nicole Belloubet, a member of the constitutional council, took over for Mr. Bayrou as justice minister, and Nathalie Loiseau, the director of the École Nationale d’Administration, an elite school that trains top public servants, replaced Ms. de Sarnez as the minister for European affairs.

Although the resignations will not hamper Mr. Macron’s ability to govern, they may undermine the president’s vow to transform French politics, which was meant to signal an intention to break from ethical scandals of the past.