A legal action challenging the election of the Liberal Democrat MP for Orkney and Shetland, Alistair Carmichael, has failed.