The 2003 Bam earthquake was (almost certainly) not caused by a nuclear test.
The US in 2013 don't think Iran yet has this capability
It is very unlikely that, ten years ago, Iran already had a viable nuclear weapon and was able to carry out full-scale test explosions without other countries being able to positively confirm it.
A senior U.S. official told The New York Times, "It's very possible that the North Koreans are testing for two countries." It would be foolish for Iran to test a nuclear weapon on its own soil. Nuclear weapons cannot be detonated in secret; they leave unique seismic markers that can be traced back to their source. An in-country test would simply confirm the existence of a program that for years Iran has denied."
USA Today, February 28, 2013
Israeli reporters in 2013 don't think Iran yet has the capability
According to Western assessments, the capacity to assemble a nuclear warhead that can be delivered via Shahab missile technology is one of the last remaining obstacles to an Iranian nuclear strike capability.
Times of Israel, February 17, 2013
It seems unlikely that either source would be motivated to underestimate Iran's capabilities to the extent that Iran could in fact have detonated a nuclear warhead ten years ago.
Seismic signatures and other ways to tell earthquakes from nukes
According to an IEEE article
it’s interesting to ponder how the seismologists can tell the difference between a nuclear bomb and a run-of-the-mill earthquake.
When you set off a big bomb underground, you would generate seismic waves. As with an earthquake, these waves would go zooming out all over the world if the energy released is large enough. The pattern of first motions is, however, quite different from what happens after an earthquake. It won’t show that one side of a fault went one way while the other side went the opposite. Rather, the set of seismic measurements would show that the initial motion was uniformly outward all around the source.
Despite these complications, seismic measurements are pretty reliable for monitoring nuclear tests.
Another way to distinguish the two may be the depth of the seismic event, as detected by seismographs. See Determining depth. Normal earthquakes have a depth of 0 to 700 Km. I believe nuclear tests are not so deep. The Bam earthquake was at 5 km - 8 km depth (quite shallow), Nuclear tests are usually at depths less than 1 Km, The deepest borehole ever dug was 12 km and took 24 years to dig (it was not related to nuclear testing).