The reason why Oscar Wilde most likely used stock characters such as dandies in his works was to mock them, primarily. Many of his works are actually criticisms of the current times, so incorporating such characters in his plays was a way for him to ridicule them.