He defeated her in a grueling Democratic nomination battle. Then she pursued his agenda across the world as secretary of state. Now, the delicate relationship between Hillary Rodham Clinton and President Obama is about to get even more complicated.

For months, Mrs. Clinton and her team have pored over Mr. Obama’s poll ratings, policies and constituencies, seeking to solve a central riddle for the campaign she is about to begin: How can she run for president as her own person, without criticizing the sitting president she served — while her Republican opponents will be working to demonize them both?

Aligning herself too closely with Mr. Obama is fraught with risk for Mrs. Clinton. Asked to imagine their “perfect candidate,” nearly six in 10 Americans said they wanted someone who would change most of Mr. Obama’s policies, according to a CNN poll released last month. And Republicans are betting that attacks based on the incumbent’s record will be as effective against Mrs. Clinton as the tactic was in 2008, when Democrats equated a victory by Senator John McCain to four more years of President George W. Bush.

“That’s the anchor she’ll be dragging for the next couple of years,” said Stuart Stevens, who was a top strategist for Mitt Romney, the 2012 Republican nominee.