And the rest of the people and entities can use it with MIT licence.
Is there any way to achieve this?
So the answer to "is there any way to achieve this?" is twofold. If the question is "can I achieve this and still legitimately use the term 'Open source software'?", the answer is a flat-out "no". If the question is "can I set it up legally in this way, without regards to the terminology", the answer is yes.
A license is a pretty free-form thing. You can write whatever text there you want. You may wish to consult with a lawyer, in order to get some legal assurance that what you wrote makes legal sense and will hold up in court. This is especially true if you want to be very sure that you didn't accidentally leave some loophole in your wording that will allow the company you dislike to use your project against your will.
You are going to have to write the text of this license yourself (or pay a lawyer to do it for you): you're not going to find much of this kind of "almost-OSS" license out there for you to base yours off of, because in general, those who want to license their software as OSS actually do want a fully OSS license. But there are a few examples, although not quite identical in spirit to your "use case" (excluding a particular company) but instead different variations of not-quite open source. For instance, you can take a look at MongoDB's SSPL (https://www.mongodb.com/licensing/server-side-public-license), and Redis Lab's RSAL (https://live-redislabs.pantheonsite.io/wp-content/uploads/20...).
> "must not discriminate against any person or group of persons"
Do you think "group of persons" is same as mentioning of a company name?
I am just trying to find a proper/correct solution to achieve this problem.
You can do anything, but a weird license restriction is going to turn off many potential users. I don’t know or care about who you dislike, and my counsel will not sign off on deploying something that cannot be used by some random people.
I am also open to listening why i shouldn't go this route, but not the way you are trying to do it.