Nuclear attribution is probably easier than undersea sabotage attribution.
For one, the list of possible suspects is much smaller with a nuclear attack. This is particularly now that covert undersea sabotage using cheap undersea drones is technically feasible for countries without a traditional submarine force. Undersea sabotage may also be carried out in a plausibly deniable way, using fishing trawlers to "accidentally" snag a cable. Probably this has already happened numerous times already, but it's very difficult to prove intent with this sort of thing.
The traditional delivery mechanisms for a nuclear weapon are easily traceable. Even using an SLBM is relatively traceable; if an SLBM comes from the Barents Sea, there will be little doubt who sent it. And the chance of the launching boomer being actively monitored by an oppositional SSN when the launch occurs is too great to ignore. The ballistic properties of the SLBM probably reveal the make and model anyway.
The greatest risk is from a nuke smuggled into the target area. However the risk of discovery is very high relative to the risk of discovery for undersea sabotage and there's no plausible "just an accident" excuse. Furthermore you have the serious risk of forensic evidence from the blast and fallout revealing the manufacturer of the bomb. And what's the point of nuclear terrorism if not to send a message, and how can that message be sent if nobody can guess who did it? With pipe or cable sabotage, the point may be to directly inflict economic damage. Using nukes to inflict economic damage is complete overkill when alternatives exist (such as undersea sabotage, hacking attacks, etc) that don't put the aggressor nation's leadership personally at risk from a retaliatory nuclear strike.