With Valentine’s Day around the corner, guys scouting for dates may gain insights from a new study indicating that good deeds may beat good looks when it comes to attracting women.

The research found that women would forgo a handsome dude in favor of a less attractive mate if he engaged in altruistic behavior, such as buying a sandwich for a homeless person.

The finding “adds to the body of empirical evidence that shows altruism has an important role in human mate choice,” according to an article in the latest issue of Evolutionary Psychology, by a research team headed by Daniel Farrelly of the University of Worcester in the United Kingdom.

“The results showed women prefer altruistic men, particularly in long-term relationships,” the study said.

Handsome hunks became even more attractive if they did some good deeds, said the study. “The increase in desirability … increased significantly.”

There’s just one caveat. Women preferred the less attractive good guys for long-term relationships. For short-term flings, the gorgeous guy — even if he did zip to help others — was preferred.

The study was conducted on 202 women, most in their early 20s. They were shown photographs of different scenarios, in which a good-looking man — and a less attractive man — responded to a situation requiring a moral compass.

For example, the two men are at a picnic next to a fast-moving river, and they notice a child being swept down the river gasping for breath. A woman cries, “Help! Save my child!”

One man jumps in the raging river to save the child. The other sees the current and chooses not to try to help.

The jumper’s status as a mate, in turn, took a leap.

The findings suggest “that if a man possesses only one of these traits, it is altruism that is more valuable.”

The study is one of a growing number that examine how altruism shapes women’s choices in mates. The authors note: “Future research needs to examine the effects found here in men’s ratings of the desirability of altruistic women as well.”