Margaret Thatcher, with at least four more years ahead of her as prime minister, flew to Washington Tuesday to bid goodbye to President Reagan and welcome President-elect George Bush to the ranks of Western leaders. The prime minister left Heathrow Airport under tight security at 4 p.m. (9 a.m. MST), bound for Andrews Air Force Base near Washington. Thatcher, who has marched in ideological step with Reagan since he took office eight years ago, thanked him in a speech Monday for what she said has been his main contribution to the West: "Let us above all thank President Reagan for ending the West's retreat from world responsibility, for restoring the pride and leadership of the U.S., and for giving the West back its confidence - confidence not only in the success of free enterprise but also in the values which guide our societies."