The former Maryland governor -- Sanders' foremost progressive challenger for the Democratic presidential nomination -- made the observation Thursday at the Iowa State Fair.
"I don't think it's a problem for the Democratic Party, but it might be a problem long-term for Sen. Sanders," O'Malley said when asked whether Sanders's self-declared socialism would be a problem.
Asked what he meant, O'Malley took another dig at the Vermont senator, suggesting that Sanders joined the Democratic Party just to run for president.
"I am a lifelong Democrat and I believe very deeply in the principles of our party. I believe very deeply in what Franklin Roosevelt was about, what John Kennedy was about, and that's why I choose to be a Democrat, not just in presidential years, but all the years of my life," O'Malley said.
The barbs come as Sanders is gaining momentum in the polls, coming out on top of former Secretary of State Hillary Clinton for the first time in a poll of New Hampshire Democrats.
O'Malley is still hoping to become the progressive alternative to Clinton's candidacy, but Sanders has in many ways stolen O'Malley's thunder, generating a grassroots movement across the country and drawing thousands of supporters to rallies.
O'Malley made the comments in a press gaggle with reporters hot off a fiery speech-turned-small rally here at the fair, where he drew the most enthused crowd of the day as supporters cheered loudly, waived O'Malley campaign signs and chanted the former governor's name.
O'Malley was the third and last presidential candidate to speak on the first day of the state fair, following Republican candidate Mike Huckabee, the former governor of Arkansas, and former Virginia Sen. Jim Webb, a Democrat.