Iran has denied allegations it was behind a militant attack on a pipeline outside Bahrain's capital.