So, when Caesar arrived in Egypt, he said that it was his job as Dictator of Rome to settle a royal dispute between Ptomely and Cleopatra on who sould be pharaoh. He even stationed himself at the Palace of Alexandria as a judge to hear the case made by both parts. Did he claim that right because Egypt was a Roman client state? If so, when did Egypt become a client kindgom? How?
So, when Caesar arrived in Egypt, he said that it was his job as Dictator of Rome to settle a royal dispute between Ptomely and Cleopatra on who sould be pharaoh. He even stationed himself at the Palace of Alexandria as a judge to hear the case made by both parts
That isn't right. Caesar at no point in the B.C. mentions his role as dictator, nor do the other sources. An invocation of Caesar's role as dictator would not have made very much sense: the Alexandrians were not a province, and therefore their affairs could not be ordered by a Roman magistrate except in his role as ambassador for the senate. It is in this capacity that Caesar interfered in Alexandrian politics. He specifically in the B.C. cites his role as consul (in 59, not in 47), not dictator, which would have made much more sense given that he also notes that the Alexandrians in killing Pompey and being unable to solve their succession crisis were potential threats to the Roman people. Moreover, Caesar notes that Alexandrian affairs had been made a concern of his personally already, since it was during his consulship that an SC, later ratified as a lex, had been passed binding the Alexandrians to the Romans as allies. No source mentions Caesar setting up court in the royal palace; this detail is not particularly believable. Indeed, none of the sources even mention Caesar entering the palace yet at this point, and the ones which describe his location in the city seem to suggest strongly that Caesar had never left the seashore. Plutarch mentions the story of Cleopatra taking a little boat to visit Caesar, Caesar says that he decided because of the fragility of the situation and the small size of his forces to remain within the area of the city that his troops controlled (the waterfront) until he could figure out what Achillas intended, and Appian speaks of fighting along the shore and of Caesar escaping at one point by swimming into the harbor. Only Cassius Dio, whose famed unreliability was the object of great (and often undue) scorn in the early twentieth century, says anything about Caesar's being in the palace. Dio says that Cleopatra snuck into the palace (also a rather unbelievable statement) to meet Caesar, who only then decided to bring the rival claimants to him to plead their cases. This doesn't make very much sense internally, since Dio then says that Caesar, who already possessed the palace, assaulted the palace (what?), and it doesn't work with the sequence of events that the other sources give.
I think you're somewhat misunderstanding the way the Romans of the Republic understood their relationships with other states. By any reasonable modern understanding the Ptolemies were clients of the Romans, and had been since the late third century. However, the Romans understood such matters in the way that Caesar describes: the Ptolemies had, in 59, become allies of the Romans, allowing them to resolve Alexandrian disputes in their own interest and according to the customs of the Alexandrians wherever possible. Similar agreements had been made earlier, but there was no permanent state of clientela that existed between the two great states. In a very real sense Caesar, as the consul who had been responsible for the most recent agreement, had a personal duty to see to it that it was respected, and being the commander on site he also was placed in a position to resolve a further agreement, since as he himself notes the agreement of 59 had been made with the last king, and technically the Alexandrians were not in a state of legal alliance anymore.
The Alexandrians had for some time been subordinate to the Romans in international affairs. In the late third century what Eckstein calls the "Ptolemaic collapse," begun by a serious of native rebellions and followed by the accession of a child king in Ptolemy V resulted in political chaos in Egypt. It was a major event for Polybius, such that he focuses nearly an entire book to it, instead of giving a broad view of Mediterranean events generally the way he usually does. By 201 warfare with the Seleucids added to the Ptolemies' woes, and Philip had begun advancing through Asia Minor, in Polybius' opinion to overthrow the Ptolemies entirely. The massive war brewing caused two traditional rivals, Pergamum and Rhodes, to conclude an alliance against Philip, and though they managed to hold out for a little while things eventually became too hot for them--in 201 the Pergamenes (friends of the Romans) and Rhodians (decidedly not) sent embassies to the Romans to ask for their aid or arbitration. Also in 201 the Athenians executed citizens of Acarnania, a Macedonian ally, and were met in response with an attack by the Macedonians. The Athenians revoked the tribes that they had long ago named after Antigonus and Demetrius, symbolically throwing off the yoke of Macedonian dominance, and appealed to the Ptolemies for aid. The Ptolemies had their hands full (Eckstein thinks they had already sent an embassy to the Romans by this point). The view from the Roman senate, which would have received these embassies, would therefore have been one of total chaos in the eastern Mediterranean. Four embassies, three of them from powerful Greek states and one from the Athenians in revolt, would have reached them within a single season, and Polybius describes the affair as confused and disordered--this was certainly the most chaotic the eastern Mediterranean had been since the death of Antigonus. The Romans, Eckstein has shown, learned (according to Polybius) of a pact between Philip and Antiochus during this time, and became worried about a total destabilization of the eastern Mediterranean. As a result, Roman attention was drawn to the region. Several decades of warfare by the Ptolemies resulted, in 170, in the deposition of Ptolemy VI, who had also succeeded as an infant, by Antiochus IV, and with Roman aid Ptolemy VI was eventually installed. In any case, the first few decades of the second century are marked by political chaos in and around Egypt, and by Roman intervention into this political shitstorm, particularly in keeping the Alexandrians propped up, such that by the first century the Ptolemies were bound closely to the Romans by a series of multi-generation treaties and friendships, and had long since stopped being able to maintain their aid without Roman power. Caesar's troops were not the first, even within his own lifetime, to interfere in Alexandrian affairs by force of arms. In 55 Gabinius, proconsul of Syria, marched into Alexandria to restore Ptolemy XII. His campaign was rejected by the senate, on the grounds that he had left his province illegally (plus while Gabinius was away Syria had been destabilized by a revolt of Alexander) to enter another independent kingdom, but the charge of maiestas failed. In particular Roman arbitration in the Ptolemid succession was a long tradition going back to the early second century, and by 47 it was almost expected that Roman arbitration would settle any succession dispute