Two reports are published and everybody is free to believe whichever they choose.
According to ICAO rules the (investigation board1 of) country of occurrence (or country of operator if it happens over international waters) leads the investigation and (investigation boards of) country of operator, country of aircraft registration and country of aircraft manufacture are asked to take part in the investigation2. So it is expected that the investigators from country where the accident happened will publish the official report.
But if some investigators may choose to publish their own report if agreement about the probable cause is not reached. But even the official report does not have any legal effect (the investigation boards don't have any legal power), so it does not really matter much.
An accident report identifies factors that contributed to the accident and suggests improvements to safety practices to reduce risk of the accident reoccurring. But whether the recommendations are implemented depends on aviation authorities3, which are separate governmental bodies with legislative power. And they decide which recommendations they will incorporate into the legal rules.
Of course each such authority only has power over that country. So while the accident is investigated just once (even when multiple reports are published, the investigation is joint effort, just the investigators don't agree on the conclusion), the rules may be implemented differently in different countries. ICAO tries to coordinate, but it does not have any legal powers itself either. So it is up to the aviation authorities to choose which report they believe more.
Assigning blame is explicitly not purpose of the investigation according to ICAO rules. A criminal trial or civil litigation may be started about the accident by complaint from police, state attorney or damaged person, in which case the investigation report will likely appear as expertise in the court, but if there is not agreement between the investigators, it is again up to the court to decide which explanation it believes most.
Finally, the investigators not agreeing is rare in practice. Usually the investigation continues until they get something they can agree on; for several years if needed. Suspected intentional crashes by pilot (which is both cases you mention) seem to be the main exception as there may be political reasons why the leading investigators (from the same country the pilots were) don't want to accept that resolution.
1Investigation board in USA is NTSB, in Canada TSB (the most rigorous investigation board in the world (or at least they very carefully collect and report even the smallest incidents, see here)), in UK AAIB, in France BEA etc.
2It is not strictly necessary, but it is the usual setup. The country of occurrence handles most investigation on site, country of registration takes care of interviewing operator and maintenance personnel and country of manufacture cooperates with manufacturer on identifying mechanical damage and usually reads the FDR and CVR data as there are only a few labs in the world that do that. Plus some of the large investigation boards may be asked for additional help. And in politically sensitive cases like MH17 additional countries may be involved to reduce risk of manipulation with the results.
3Aviation authority in USA is FAA. In Europe there is EASA, which coordinates the regulations, and separate authorities in each country that carry out the actual oversight.