It's complicated
But you should probably tell them.
Theoretical underpinnings: Some kinds of utilitarianism
There are two species of utilitarianism: indirect or rule utilitarianism, which is a species of deontology, and direct or act utilitarianism, which is a species of consequentialism (I don't agree with the SEP's labels here, but ah well).
In rule utilitarianism, you set out a series of laws, the general observance of which would result in the greatest good for the greatest number of people. So if it were better for everyone if nobody ever stole, you should never steal.
In act utilitarianism, you consider the marginal effect of individual actions. So even if humanity would be better off in the event that we never stole, if stealing this one thing this one time would be better than not stealing it, you should steal it.
Finally there's preference utilitarianism: essentially that you should treat other people as they would like to be treated. This is in fact not in conflict with either of the two forms mentioned above, but it's an important enough school of thought to warrant its own mention.
Arguments for either kind
As long as you are convinced that the source of goodness is human happiness, there are some pretty good reasons to be either a rule or an act utilitarian.
On one hand it's much easier to follow determinate laws than the calculate the effects of individual actions. In fact this is so hard that it may even be the case that humans will generally be happier in a rule-utilitarian society than in an act-utilitarian society. It's rare that we want to only look at the marginal effect of an action, because it's really generally impossible to examine the complete marginal effect of an action. Besides, the effect of allowing people to view their actions solely on the margin is huge; you're essentially saying goodbye to law as such.
On the other hand we might question why we should refrain from doing something that we know will lead to a better outcome right now. Of course we're not really telling other people anything with our decision to be an act utilitarian, unless we in fact tell them that we are being act utilitarians. So we don't set any precedent, because nobody has to find out.
OK, but what should I do?
If you're a rule utilitarian, then you know that lying is bad, so you shouldn't lie. Therefore tell them the truth.
If you're an act utilitarian, you have to ask: will this in fact do more harm than good? For instance, you're suffering right now because of your guilt. And there's an outstanding chance that your spouse will find out that you have cheated anyway and be even more devastated because you have hidden it. If you really don't care about having cheated on them, and you are confident that they won't find out, then, fine, I guess, don't tell them. Those last two statements probably aren't true though. So you should confess.
But! If you are a preference utilitarian, we have a neat solution! Ask your spouse, "Would you rather live a lie or learn some terrible news?" And if they say they would rather learn the news, even if they would be less happy, then tell the truth.