Spears and Chalke will appear in the episode slated to air March 24.
"Continuing his passionate quest to find the woman who will one day be his wife, Ted (played by Josh Radnor) pursues his beautiful dermatologist, Stella. While Stella turns down his repeated efforts for a date, her office receptionist, Abby, becomes smitten with Ted," a press release announcing the installment said.
"Scrubs" star Chalke will play the dermatologist, while Spears has been cast as the receptionist.
Notable deaths of 2014 [PHOTOS]