CONCORD, N.H. — As Rick Santorum sprinted Thursday through New Hampshire, a state with fewer social conservatives than Iowa, his views on social issues like same-sex marriage were quickly challenged.

A midday event in front of a gathering of college students here turned into a testy exchange in which Mr. Santorum compared allowing gay couples to marry to polygamy, apparently equating the two as equally undesirable.

“If you’re not happy unless you’re married to five other people, is that O.K.?” he asked.

The students booed Mr. Santorum during the 10-minute exchange and loudly booed when he left the room. The students were part of College Convention 2012, a forum organized by New England College and open to students from all over the state, regardless of political party.

Mr. Santorum, a Republican former senator from Pennsylvania, has generated criticism in the past for his views on social issues. In 2003, he argued that the Supreme Court should not overturn state bans on homosexual sex, saying that could create a precedent allowing bigamy, polygamy and incest.