In the master page options, apply master to pages, indesign doesn’t remember the last option used for the master. For example if I have set a particular master for pages 6-9 and then I decide to use it for 1-4 only, then indesign still retains the master for 6-9. I can’t delete it. What should I do?
It sounds like it is working the way it is supposed to. If you apply a master page to a document page, it remains applied until and unless you apply a different one. What you would do in your situation is to apply the master to pages 1-4, and then if you don't want it on 6-9, you would apply a different one to those pages.
If there is more to the story, please tell us.
I think we may be miscommunicating over terminology. Every document page is based on a master page, so not applying a master isn't an option. When you start a new document from scratch, the default master page is called A-Master, and it is applied to the one document page (unless you enter a different number into the pages field in the New Document pallet). You can apply None to your document pages, but essentially, None is a type of master as well.
If I understand your initial question, you have a document with at least 9 pages, that probably started with A-Master being applied to all 9. At some point, you made a new master, which by default was probably called B-Master (but you can change the name of the master if you like), and applied B-Master to pages 6-9. You then applied it to 1-4, and expected pages 6-9 to revert back to A-Master, but it won't do that unless you tell it to. Even if your document pages started with None instead of A-Master, and you applied A-Master to 6-9 instead of making a B-Master, they still won't change back to None just because you apply A-Master to 1-4. I can't imagine how fouled-up things would get if master pages just assigned themselves without me telling them to.
Maybe I missed the meaning of your question, so I hope you'll come back and clarify it for me.
what if i don't want any master to be applied to it?
Apply the master page called [None] at the top of the panel. That page cannot be edited and contains only the margin settings you established at document setup.