I am not licensed in Pennsylvania, so I can only give general advice based on my experience in Maryland and Virginia.
Generally, a judge will rely on the advice of the medical doctor who has personally evaluated the patient, is specifically qualified in the area of the patient's illness and can testify on the matter. In some cases, two independent doctors must certify incompetence. The standard for the applicable jurisdiction is very likely statutorially prescribed.
The unbiased guadian, probably a "guardian ad litem" would be appointed to protect the interest of the incapacitated person. The guardian ad litem will likely be an attorney who is specially qualified to handle such matters. The guardian ad litem should meet personally with the incapacitated client. The guardian ad litem will also make reccommendations to the judge.
The judge will listen to the doctors, the guardian ad litem, and perhaps, other testimony from the incapacitated individual and from the other family members. Using Solomonic wisdom, the judge then determines if the criteria for incapacity are met, and then makes a ruling.
Regarding the portion of your question dealing with dementia, it realy does not matter if the diagnosis is dementia, or something else. The standards are likely the same no matter what is causing the incapacity.
It is my experience that the judge generally relies very heavily on the expert opinions, including that of the doctor (or doctors) in making a determination. Depending on the judge's professional relationship with the guardian ad litem, and the guardian ad litem's reputation with the Court, the judge will give a varying degree of importance to the testimony of the guardian ad litem. Rather than one of the family members hiring a guardian ad litem, it is probably best to let the court appoint a guardian ad litem, if that is an option. Doing this, you remove the appearance of possible bias on the part of the guardian ad litem.
I assume that by "POA" you are referring to a Power of Attorney. Hypothetically speaking, a typical scenario may be that the POA is a contingent or "springing" POA that gives authority to the attorney-in-fact upon the principal's incapacity. Perhaps the alleged incapacitated individual signed such POA while she had capacity, and she is now contesting her attorney-in-fact taking action on her behalf.
If this is the case (or in a similar set of circumstances), the POA may have a standard for determining the incapacity of the principal.