Yes, you are definitely on the right track. What you show should work on any files in the ~/Desktop/test folder as well as any files selected in the Finder. If any of those have the md extension, they will be opened.
What do you mean by that?
If a variable contained "md", then you could use that variable (eg, %Variable%DesiredExtension%) in the is condition in the If Then Else action.