The Briton replaces Pascal Wehrlein, who announced his immediate departure from the team earlier this month.
Lynn has Formula E experience under his belt, making his debut in the series for DS Virgin Racing in the 2016-17 season, securing pole position on his very first outing.
Lynn remained with DS Virgin for the following season but saw his relationship end with the team at the end of the campaign.
In 2019, he raced at the final seven rounds of the season for Jaguar Racing, scoring a best result of seventh place in Switzerland.
Berlin, which is the sole host of the 2019-20 season's final rounds, will see Lynn return to the all-electric championship.
"I am really excited to be able to represent Mahindra Racing in Berlin. I have high ambitions in this championship that match what Mahindra Racing wants to achieve. I just can't wait to get started.
"I've raced twice in Berlin before and always felt that I went well there, including appearing in superpole last season.
"The format of Berlin is going to be exciting and challenging at the same time and I'm looking forward to hitting the ground running."
Mahindra CEO and team principal Dilbagh Gill added: "[Alex] has achieved some fantastic highlights in his career already and we're confident that together we can get results in the remainder of the season.
"It's not easy to jump in mid-season, especially with the unique way we will be running the races in Berlin, but Alex has a hunger, talent and experience that we are sure will pay dividends fast.
"We would like to thank Pascal for his contribution and wish him all the best in his future endeavours."
Bahrain International Circuit - Winter testing
Would you like to stay up to date with the latest Lewis Hamilton and Formula 1 news from GPtoday? Activate free push notifications and be the first to know!