It is possible to create dashed lines in Adobe Illustrator using the “dashed line” option in the Stroke panel (Window → Stroke):
However, illustrator doesn’t allow you to select the colours of the “dashes”; it simply leaves gaps in the paths. But there’s a simple fix. First, create the path you want to be dashed using whatever method you prefer:
Now, select the whole path using the Selection Tool and press Ctrl-C, Ctrl-Shift-V (or Cmd on Mac). This creates a copy of your path at the exact same spot as your original path. Select a different stroke colour and use the “dashed line” options mentioned above. Voilà, you now have a dashed curve with two colours: