The International Atomic Energy Agency (IAEA) was designed as an apolitical technical agency that - among other things - takes regular accounting of member states' nuclear material to make sure none is diverted to weapons uses.
However, the agency has been veering from its impartial technical mandate and is selectively pursuing certain member states based on intelligence from other states.  For instance, the Associated Press reported that about 80% of the evidence it has against Iran comes from its arch-adversary, the United States.
The IAEA urgently needs to return to being a technical and impartial inspection shop, and not be seen as being politically biased or an extension of Western intelligence.  Reforming its funding stream is an overdue first step to restore confidence in the agency's impartiality and removing any potential conflicts of interest.
As long as most of the IAEA's funding comes from the US and its allies, the agency is likely to have biases and be susceptible to politicization and conflicts of interest.  All told, about 65% of the IAEA budget is from the US and its allies, which makes the directorate especially beholden to political pressure from Washington.
This politicization of the IAEA is evident in how it has handled Iran's case.  In 2005, Iran was deemed in non-compliance with its IAEA nuclear safeguards agreement. Even though non-compliance findings themselves are notoriously subjective and selectively enforced, Tehran had by 2008 already explained or corrected every substantiated and lawful concern, as confirmed by the IAEA.
Despite this, the IAEA then raised other ad hoc possible military dimensions concerns based on foreign intelligence, but which are largely outside the legal authority of the agency to pursue because they do not clearly involve the diversion of nuclear materials to nuclear weapons uses. 
These remaining unresolved issues include some unsubstantiated allegations from third-party intelligence agencies with their own axes to grind with Iran, and are mostly related to rather flimsy allegations of possible work done in Iran more than 10 years ago. 
From a technical perspective, the allegations make little or no sense. Dr Jim Walsh, a research associate at MIT, has an excellent suggestion about what to do with Iran's "possible military dimensions" file (as paraphrased by Mark Hibbs): "If the nuclear activities were in the past, I don't care. It's dead, and it's regretful, but let's do a deal with Iran that moves forward."
For its part, Iran has maintained that these allegations are baseless  and that the data have been fabricated. An internal IAEA document obtained by the author, excerpted below, shows that the IAEA is exceeding its legal authority in probing Iran about things the agency has no business - or even capability - to investigate.
Some leaked evidence has not even stood up to scientific scrutiny. This does not bode well for the quality of the rest of the secret allegations against Iran that the IAEA says it possesses. Indeed, it's possible that the agency is again in possession of fabricated evidence. 
The safeguards agreement between Iran and the IAEA spells out how to settle any dispute that doesn't involve such diversion: through arbitration. So if the IAEA wants to pursue Iran over these extra-judicial allegations and subjective "concerns" it has the option of kicking off arbitration.
Both the original - and the continued - referral of Iran's nuclear dossier to the UN Security Council is inconsistent with international law. If the IAEA does not avail itself of the arbitration option it must now withdraw the Iran nuclear file from the UN Security Council, which has also mishandled the issue. 
According to an internal IAEA document obtained by the author, the agency's current allegations and concerns are as follows:
High explosive initiation
Nuclear material acquisition activities
Modelling [sic] and calculations
Testing, missile integration
Arming, fusing and firing
However ominous-sounding, none of these topics - whether they come from the IAEA's own investigations or from adversarial intelligence agencies with their own national security agendas - relate to the diversion of nuclear material to weapons uses, and are thus outside the legal authority of the IAEA to pursue.  The IAEA itself admits that "absent some nexus to nuclear material the agency's legal authority to pursue the verification of possible nuclear weapons related activity is limited."
Topic 4 on missiles, in particular, has nothing to do with the IAEA at all: even if the IAEA obtained information from Iran on its missiles it does not have the expertise and knowledge to evaluate it. In fact, even on nuclear weapons issues there are probably two people at the IAEA with the necessary expertise according to Robert Kelley,  a veteran US weapons engineer and former IAEA inspections director. The IAEA was never designed - and is neither staffed nor equipped - to be a nuclear weapons inspections agency.
Because UN weapons inspectors have, in the past, been entangled with Western intelligence agencies it is understandable that Iran may not wish to volunteer the kind of information the IAEA is now requesting. David Kay, the chief UN nuclear weapons inspector in charge of monitoring Saddam Hussein's nuclear program in 1991, told PBS that foreign spy agencies were linked to the mission in Iraq.  "The intelligence communities of the world had the only expertise that you could use if you were unmasking a clandestine program," he said. "I realize it was always a bargain with the Devil - spies spying."
Daniel Joyner, a noted NPT authority, notes that, "the IAEA simply has no legal mandate to… report on activities being carried on within an IAEA member state concerning items and technologies that may be related to the development of a nuclear explosive device, but that are not directly related to fissionable materials or associated facilities."
As for the accountancy of nuclear material in Iran, according to the latest (May 2013) IAEA report,  the agency "continues to verify the non-diversion of declared nuclear material at the nuclear facilities and LOFs [locations outside facilities] declared by Iran under its Safeguards Agreement." - as it has done every year since IAEA safeguards have been in place in Iran. Six former ambassadors to Iran confirm that Iran is not in breach of international law, and that the West's strategy has backfired and contributed to the concocted crisis. 
Dr Hans Blix, the former director of the IAEA has also weighed in on the issue: "So far Iran has not violated NPT and there is no evidence right now that suggests that Iran is producing nuclear weapons. The fact that Tehran has enriched uranium up to 20% leads to suspicion of a secret weapons program, however, no action can be justified on mere suspicions or intentions that may not exist."
If a stronger "NPT 2.0" treaty with a more powerful IAEA inspection arm is desired this could be hammered out in the future, but the current treaty - and the independent bilateral Comprehensive Safeguards Agreements - reflects the compromises made to gain wide adherence of those agreements. 
Secret evidence from third-party intelligence agencies,  especially if they are from non-NPT states, should not be allowed to gin-up the IAEA on extrajudicial missions against Iran, or any other NPT signatory states. But the IAEA's conduct reflects the fact that the IAEA's funding comes mostly from the US and its allies.  As the ancient maxim states: "Follow the money". One way to fix this problem would be for the IAEA to receive funding via a "blind" UN fund with no knowledge of the precise fraction provided by each state.
The ad hoc and unprofessional handling of the Iran dossier by the IAEA now threatens the integrity of the non-proliferation regime. Absent serious reform at the IAEA, it appears that Samuel Huntington's prediction about the future of arms control draws closer every day:
"In the post-Cold War world the primary objective of arms control is to prevent the development by non-Western societies of military capabilities that could threaten Western interests ... The West promotes nonproliferation as a universal norm and nonproliferation treaties and inspections as means of realizing that norm ...The attention of the West focuses, naturally on nations that are actually or potentially hostile to the West."