"Which is true?"
Both theories are true.
"1) He is addicted to gambling or has a weakness for gambling. i.e., he had a gambling problem."
"Yudhishthira's addiction of Gambling", was referred as a pre-text in Adi Parva:
Janamejaya said, ... Why also did the two other sons of Pritha (Bhima and Arjuna) and the two sons of Madri (Nakula and Sahadeva), themselves injured by the wretched Kurus, follow Yudhishthira who was greatly addicted to the evil habit of gambling Why also did Yudhishthira, that foremost of all virtuous men, the son of Dharma himself, fully acquainted with all duties, suffer that excess of affliction? ...
And Bhima also addressed Yudhishthira about having this vice during Vana parva:
Bhima among them addressed Yudhishthira, saying, '... Endued with manliness, we are yet overwhelmed with calamities, in consequence of thy gambling vice, ... O foremost of monarchs, all this is the result of thy addiction to gambling. We are on the verge of destruction already, ...'
Important to note that, Yudhishthira may have gambling habit, but he was not well versed with "dyut" (game of dice) kind of gambling; neither he was deceitful in anyways. In the same page he admits:
O holy one, summoned by cunning gamblers skilled at dice, I have been deprived of wealth and kingdom through gambling. I am not an adept at dice, and am unacquainted with deceit. Sinful men, by unfair means, vanquished me at play.
Hence, he was well aware of consequences of playing with Shakuni. But he had to accept it as a part of Kshatriya duty/usage.
"2) Kings can't decline a gambling challenge or request according to Dharma."
For Kshatriya-s, it was a kind of protocol to accept the gambling challenge.
Arjuna hearing this, said, '... The king was summoned by the foe, and remembering the usage of the Kshatriyas, he played at dice against his will. That is certainly conducive to our great fame. 'Bhima said,--'If I had not known, O Dhananjaya, that the king had acted according to Kshatriya usage, then I would have, taking his hands together by sheer force, burnt them in a blazing fire.
Yudhishthira was not a foolish gambler either. But he was dragged into it, as discussed in the last section of this answer:
... I do not desire, at the command of king Dhritarashtra to engage myself in gambling. The father always wisheth to benefit his son. Thou art our master, O Vidura. Tell me what is proper for us. Unwilling as I am to gamble, I will not do so, if the wicked Sakuni doth not summon me to it in the Sabha? If, however, he challengeth me, I will never refuse. For that, as settled, is my eternal vow.
"Is gambling considered not just moral but also the righteous thing to do?"
Gambling is considered the biggest among cheaters.
It seems that there is a contradiction here. Gambling is considered a vice as well as a Kshatriya Dharma or usage. Hence we may interpret as following to cater both terminologies:
- Deliberate & excess indulgence in gambling is adharma. This also becomes vice, when it's beyond playfulness; e.g. using it as a tool to steal someone's belongings in deceitful way
- Since "dyut" was a famous sport in old times, and as mentioned in above scriptures, Kshatriya-s were having a protocol to accept it; Accepting a protocol, even though seemingly bad, is still a Dharma
This is a special case, where Dharma is not limited to "righteousness"; rather we have to consider its generalised meaning as "tendency". e.g. Kshatriya-s have tendencies to indulge in certain battles & sports, even though they are dangerous; this may not be right overall, but right for the specific class of people.
Currently "sacred-texts.com Mahabharata" is a kind of ad-hoc standard for this site. Hence I would not go into what other versions says.