How can I invest money in stocks via USA broker, while being a citizen of Ukraine? I don't want to go through brokers in my country, because we don't have a good legal system and a lot of corruption, so I think it is not very safe option.
The US has a tax treaty with Ukraine (unlike Singapore), so you should be in a similar situation to Canadians etc. who choose to use a foreign broker.
You'll have to file a W8BEN to reduce withholding taxes, and they'll want identification documentation and so on, and I imagine they'll want a wire transfer to fund the account.
In many places now they are requiring permission to share information with the tax authorities in your home country (you waive your privacy), but that may not be true with Ukraine, and should not be a problem in any case if you're being upfront.