You can do this with the following command:

    :sort /\(# \)\?\ze/

This skips the `# ` if it exists, and then sorts on the remainder of the line. However, the pattern matches every line, so they are all sorted in a single group.

You will want to add a range to the start of the command to apply this to the appropriate lines in your file.

The following command also works, coming at it from the opposite direction:

    :sort r /\(# \)\?\zs.*/