Dashed borders are a nice alternative to the plain and sometimes boring
solid borders. This tutorial is formed of two main parts, first we need to make a pattern
that we will use after to make the dashed border.

Take the pencil tool (right click on the Brush tool and select Pen
tool) and make something like the image below (image is zoomed).

Now we'll make it a pattern. Go to Edit > Define Pattern. Put the name
you want and click OK.

Second step: adding the border

You can close that image now. Open the image you want to apply the dashed border. I
used this one:

Select all of it but leaving a margin of 1 pixel with the border, like this (note that
this is just a part of the image zoomed):

Invert the selection by going to Select > Inverse. Create a new
layer to put the border (press Shft+Ctrl+N) and go to Edit
> Fill. Select Pattern from the dropdown menu and select the
pattern you made before. Click OK and deselect the area ( Select > Deselect
or Ctrl+D ). Ready! there you have your dashed border, now just save it (File > Save for web)

Alternate step: change border color

If you want the border to be another color, just go to Image > Adjustments
> Hue/Saturation and select the color you like or that most fits the image. My
final result is below.