The actor, who recently bowed out from his role as Walford villain Archie Mitchell, will appear in the play at the Menier Chocolate Factory theatre from March 27.
Actress Laura Dos Santos, who took part in a Radio 4 adaptation of Educating Rita which was broadcast at Christmas, has also been cast in the show.
Written by Willy Russell and originally premiering in 1980, Educating Rita tells the story of a young, brash hairdresser named Rita (Dos Santos) who enrols with the Open University to study English literature. Her unique reactions to the classics subsequently challenges the attitudes of the university and her lecturer Frank (Lamb).
The play forms part of a Russell season at the Menier Chocolate Factory, which will also see Meera Syal taking on the title role in his 1986 play Shirley Valentine. Tickets for both productions go on sale today.
Lamb appeared in EastEnders for the final time at Christmas, but his character is expected to be the focus of attention in tonight's live 25th anniversary episode as viewers discover who killed Archie.