The lexical root of 'tasawwuf' is variously traced to sūf "wool", referring to the simple wool-made cloaks the early Muslim ascetics wore and who claimed to purify their inner self from filth and stay away from worldly attractions, thus engaging in so-called spiritual self-reconstruction. This Sufi way of thinking was further developed over the history by different sects that added more and more features and traits to it. Sufi teachings cannot be accepted thoroughly or rejected outright because their doctrines are a combination of correct religious behaviors and incorrect innovations originating in their tastes. Unfortunately, this incorrect combination has led some people who intend to practice the first part in accordance with the Quran and Sunnah (prophetic tradition) to be erroneously accused by some credulous and naive people of being dervish or Sufi. One of those great people who have been accused of being a dervish is Imam Khomeini – may his soul rest in peace. As a matter of fact, if we go through his writings and words and examine them meticulously, we will come to the conclusion that Imam Khomeini (r.a) criticized innovative and ostentatious Sufi practices as much as he stressed on self-reconstruction and spiritual purification. Although Imam Khomeini (r.a.) is counted as a gnostic ('arif), he cannot be considered a Sufi in its most well-known sense.
At first, it is necessary to know that Islam is a school that guarantees prosperity and happiness of mankind in this world and in the Hereafter. The material and spiritual needs of those who adhere to Islamic doctrines are fulfilled. It can easily be understood through the Quranic verses that God has called on His servants to relinquish worldly desires and pay attention to spirituality and the Hereafter but He has also reminded them not to go to extremes by isolating themselves and giving up activities related to the material world. In fact, they should also benefit from worldly bounties and blessings and carry on their daily activities in accordance with religious standards and be not oblivious of God at the same time.
Therefore, a real Muslim is one who is not whimsical and worldly-mind but he benefits from the worldly blessings and uses them as a means for the afterworld. Thus, he prays to God for his good both in this world as well as in the hereafter.
However, there have always been people who go to extremes and who take only one aspect of the religion into consideration practicing it and neglecting the other aspects.
Some of them adhere only to the worldly aspects of the religion such as maintaining law and order, establishing government, agricultural activities, business, scientific advancements etc. They are negligent of the fact that all of these are only preludes for the perpetual life in the Hereafter, and more importantly, they are meant for seeking God's pleasure and that they are valueless by themselves.
Some others stick to the spiritual aspects of Islam abandoning the world and leaving any activities that are an integral part of a social life thus making themselves a burden on the others. It is interesting to know that some of these individuals use the apparent renunciation of the world as a means for saturating their carnal and worldly desires!
In the light of above, we come back to your question and examine the following two points:
1. In view of the fact that woolen garments were the cheapest of clothes in the early period of Islam, normally poor and indigent people used to wear such type of garments. If a person wore such clothes to fight his carnal desires and renounce the world, there would have been no objection to it. In this respect, Abuzar Ghaffari who was a great pious man says as such: "I have two loaves of bread one of which I eat at midday and the other at dusk and I have two pieces of woolen cloth one of which I wear to cover my private part and the other I put on my shoulders, I have nothing to do with the world!
In fact, by saying this to the people around him, he wanted to imply that a person could be contented with the least if necessary and that he himself did not exchange his faith for the world and it did not mean that he considered divine bounties to be haram because we know for sure that when Abuzar lived in exile, he had some thing, though little, for himself and his family to eat and to survive.
Later on, a group of Muslims went to extremes in terms of pietism secluding themselves from the world to the extent that they termed wearing shabby woolen clothes as the Muslim expression raising objections even to the Infallible Imams and the nobles. In other words, they turned real piety which is recommended by the religion to piety-mongering (pietism) seeking clients for themselves and falling, willy-nilly, into the trap of a world which they were apparently renouncing.
Considering that the lexical root of 'tasawwuf' is traced to sūf "wool", gradually those who were wearing simple wool-made cloaks were known as Sufiyah or Mutsawwefah and their school of thought was named "tasawwuf". In late centuries, names like Dervish, Kharabati etc. have also been used to refer to these individuals. Terminologies like Khaneqah, Mey, Pir, Qalandar etc. enjoy a special place in their school.
Moreover, we must know that Sufi teachings are not restricted to wearing woolen clothes and that the masters of this school have announced other behavioral standards or codes of practice to the proponents. Some of these codes are baseless and ungrounded religious innovations and some others were evaluated in line with Quranic and Shari'ah rules. In this connection, sometimes the actions which were rooted in the religion were modified somehow and changed into an innovation. For instance, there are narrations prescribing a certain deed to be performed sincerely for a period of 40 days which, if done accordingly, will lead to very positive results but the Sufis have changed it into "seclusion rite" [chelle nishini] and added certain manners to it which are not consistent with the sacred Shari'ah of Islam. As a result, Sufism changed into a composite of valid practices and innovations originating in the Sufists' tastes. This led some Muslims who were seeking to perform only the religious laws and engage in self-reconstruction according to the divine instructions to be labeled and accused of being Sufists or dervishes.
In view of the above, it can be said that although some external forms and rites of Sufism are not rooted in the religion, we cannot and should not reject or endorse the entire Sufi teachings. In fact, the Sufi teachings should be examined section by section and its conformity with the religion should be checked. Moreover, it is not appropriate to accuse a Muslim, who gives more importance to the spirituality and to self-reconstruction methods, of being a Sufi.
2. We know that Imam Khomeini (r.a) was a person who from the very beginning of his life walked in the path of spiritual self-reconstruction and he maintained this method until the end of his life. Therefore, one may come across some interpretations in his words and poems similar to those of Sufi beliefs and terminologies. At first glance, one who reads the Imam's poems may feel like he is biased to the Sufi school but one should not pass judgment about him quickly. In fact, one should note that the terms used in Imam Khomeini's poems signify realities which perhaps one may not be able to propound forthrightly. Moreover, we should pay attention to Imam Khomeini's other poems and sayings also and then draw a conclusion. He has poems that apparently oppose the so-called Sufism. The question is: What should we do with these two sets of apparently contradicting poems? How to reconcile between them? Did he accept Sufism or not?
The answer is that Imam Khomeini accepted and endorsed those sets of Sufi teachings that were in line with Islam's sacred Shari'ah and which Muslims could use for spiritual self-reconstruction. He said, "We should know what God's conversations with man are; we should believe in those conversations and should not deny them; we should not say they are dervishes' talks. All of these issues are in the Quran but in a subtle way; they are also in the supplications which have been narrated from the pure Imams. All of these are there in a delicate way. All of those who later on used these terms have knowingly or unknowingly taken them from the Quran or traditions and they might not know correctly the sources also."
Therefore, according to Imam Khomeini (r.a), we must not be afraid of being labeled as Sufi or dervish and that it should not deprive us of engaging in self-reconstruction but all these sayings of Imam Khomeini (r.a) do not imply that he endorsed or approved of Sufi practices. In a letter written by Imam Khomeini in his youth age decades before the Islamic revolution of Iran, he says:
"Do not be credulously pleased with the words of the masters of Sufism and mysticism; and do not pay heed to the noisy supplications and vainglories of those wearing the (Sufi) cloak."
Decades later, in 1984 late Imam Khomeini (r.a) strongly recommends his son Hujjatul Islam Sayed Ahmad to engage in self-purification and spiritual self-reconstruction. Meanwhile, he tells him as such, "What I have said (to you) does not mean that you should isolate yourself from the society and live a secluded life and be a burden on the people of God (Khalqul-lah) because this is a feature of the ignorant hermits and the shop-keeping dervishes."
In another piece of advice to his bride (Sayed Ahmad's wife), Imam Khomeini (r.a) says as such: "I do not want to purify as the claimants do for many a cloak may cause fire. I want you not to forget meaning and spirituality, the one mentioned by the Book and Sunah. The opponents have either ignored it or made a vulgar justification of it."
Imam Khomeini (may Allah bless him) has strongly criticized minimalist and maximalist views in this regard, and he considers one's intention and inner motive as the standards for acceptance of deeds. He is opposed to the ostentatious actions, manners and behaviors as he puts it as such: "My son, neither mystical seclusion is a reason for being with the truth nor are entering the society and establishing a government a proof for being detached from the truth. The criterion for an action to be good rests in the motives attached with them. Many a worshipper and a pious devotee may be caught up in the trap of the Iblis (devil)."
Thus, if we come across a saying from Imam Khomeini (r.a) which may sound like he is confirming the Sufism and dervishism, we must not take it as a real confirmation of the formal Sufis and dervish orders; rather we must evaluate their beliefs and practices in line with Quranic injunctions and prophetic traditions.
 - Al-An'am: 32; Yonus: 24; Al-Ankabut: 64; Muhammad: 36; Al-Hadid: 20 and hundreds of other verses.
 - Al-A'raf: 32; Al-Baqarah: 168; and 172; Al-Maedah: 88; Al-An'am: 141; Al-Mulk:15 etc.
 -Al-Baqarah: 201,
"ربنا آتنا فی الدنیا حسنة و فی الآخرة حسنة و قنا عذاب النار".
"Our Lord! Give us good in this world and good in the hereafter and save us from the torment of the (Hell) fire."
 - Kulayni, Muhammad bin Ya'qub, Al-Kafi, vol.2, pg.134, hadith No.17, Islamic Publications, Tehran 1986.
 - Majlisi, Muhammad Baqir, Behar al-Anwar, vol.22, pg.429, hadith No.37, Al-Wafa Institute, Beirut, 1404 A.H.
 - Al-Kafi, vol.5, pg.65, hadith No.1.
 Ibid, vol.2, pg.16, hadith No.6.
 - For further information about the emergence and development of Sufism, see books like "An Inquiry into Iran's Sufism" by Dr. Abdul Hussein Zarrinkoob.
 - Sahifa of Imam Khomeini, vol.17, pg.458.
 - Sahifa of Imam Khomeini, vol.1, pg. 18
 - Sahifa of Imam Khomeini, vol.18, pg. 511.
 - Sahifa of Imam Khomeini, vol.18, pg. 453.
 - Sahifa of Imam Khomeini, vol.18, pg. 512.