Why if there's a higher inflation rate in country A then its exports are less competitive and its trading partners prefer to buy from countries with lower inflation rates?
Competitiveness simply means how expensive goods of a country are when compared. To correctly compare we would need to transform everything into a(ny) single currency. To do this correctly we need two elements: a) the actual price of the good and b) its exchange rate. If a country has higher inflation, then nominal prices increase, the goods are more expensive, less desirable and therefore due to (a) competitiveness decreases.
However over time (if purchasing power partiy (called PPP) holds. If it holds its typically in the long run) then due to higher inflation in a country, the currency will likely lose value (depreciate) and competitiveness will increase due to (b), in which case it will eventually cancel the aforementioned effect (a) in which case your confusion is completely justified, there should be no effect.
However since PPP does not always hold and especially not immediately, higher inflation reduces competitiveness.
In classical economic models prices have no effect on economic variables. Thus, high inflation would be fully compensated by changes in the exchange rate. However, in models with frictions, this is no longer the case. For example, in a model with sticky prices the inflation rate does affect exports.
Suppose that each seller can reset prices with some fixed probability in each time period (Calvo-type price setting). Then in a country with high inflation, the seller will choose a price that is much higher than the current efficient price. The reason is that the seller anticipates price level increases in future time periods in which he cannot reset prices. However, if the seller has not reset his prices for a long time, his prices will be too low since inflation has decreased the real price over time. Note that these inefficient prices are not compensated by the exchange rate, since the exchange rate can at most compensate for the inefficient price of a single seller.
We have now seen that high inflation rates can lead to inefficient prices, but sometimes these prices may also be too low and thus should encourage sellers abroad. However, two empirical facts may explain why trading partners abroad may avoid buying from high-inflation countries. First, many sales contracts are made for longer terms. Second, countries with higher inflation usually also have a higher inflation volatility. Both these points add significant risks to buyers and sellers in addition to the aforementioned inefficient pricing. Therefore, the reason why buyers may prefer sellers from countries with less inflation (if true), may simply be risk aversion.
It is less likely that a country with a strong economic environment has high inflation. This calls for an attempt in figuring out what factors high inflation is correlated with in a particular country and what the externality of these factors have on a trading partner in that country compared to another candidate which is unaffected from those externalities.
Many relevant correlations might be observed. I will make some guesses even though they should be confirmed. Take risk of default by firms for instance. One might claim that the causes of high inflation have a negative impact on these default risks. Then, regardless of risk attitudes of buyers, a firm in a high inflation country needs to be producing at a lower cost than a competitor in a low inflation country to be as competitive as the other candidate which is enjoying lesser of the justified bias from the buyers.
One another correlation would be the quality of legal institutions in the high inflation country. Again, one would expect a less desirable legal system in a high inflation country, and a potential importer in another country would discount the benefits of trading with someone from a country which has such a legal system. This in turn will imply some extra hurdles to overcome for the exporter in the high inflation country.
There may be many other such negative externalities. Also, one of course needs to take into account the possible correlations that will have a positive externality for a high inflation country's exporters. A very simple one is that if a firm is able to survive in a high inflation country, then it is more likely that this firm is stronger than a firm that can offer trading benefits similar to another one in a less inflation country.
Intuition suggests that there would be an overall negative impact, which would reduce competitiveness in international trade.