You can take the exam as many times as you wish. There is no limit as to how many times you can take the foreign service exam. However, you must wait at least one year between each trial.