Ahead of the anticipated arrival of Mr Johnson in Downing Street on Wednesday, Sir Alan, a vocal critic of the ex-foreign secretary, announced his imminent departure from government.
Refusing to serve under an administration led by his former boss at the Foreign Office, the minister added that Theresa May "deserved better" and claimed her self-esteem will "far exceed" that of her critics.
Sir Alan, who started used his resignation letter to list achievements at the Foreign Office, also noted: "I remain deeply upset that some fruitful discussions I had initiated about the possible release of Nazanin Ratcliffe were brought to such an abrupt halt".
The case involving Ms Zaghari-Ratcliffe has been widely cited as one of Mr Johnson's most damaging episodes at the Foreign Office, after he erroneously told a Commons committee the British-Iranian mother was involved in training journalists.
During the leadership campaign, Mr Johnson claimed his remarks didn't "make any difference", but Ms Zaghari-Ratcliffe's husband, Richard, said the comments enabled an Iranian propaganda campaign to be waged against her.
"We saw a couple of weeks... afterwards, [Iran] accusing her of being a spy and [saying] the foreign secretary approved it, which obviously had very traumatic effects for her," Mr Ratcliffe told the BBC last month.
Mr Ratcliffe added that Mr Johnson’s comments were used to justify a second court case against his wife in Tehran, and said they “probably even caused it” and had been used “to discredit her ever since”.
Sir Alan, who has previously described himself as Mr Johnson's "pooper scooper" during his tenure as foreign secretary, added in his letter that it was "tragic" the department had to "spend every day working beneath the dark cloud of Brexit".
He continued: "On a heartfelt person note, I have known you [Ms May] and Philip for over forty years throughout which you have both displayed faultless dignity and an unstinting sense of duty.
"I am only sorry that your three years as prime minister have been brought to an end. You deserved better, but please taking lasting comfort form the knowledge that your self-esteem can, and will forever, far exceed that of your critics."
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies