The court rebuffed the administration’s efforts to dismiss the case, upholding the principle that public-interest advocates can hold the president accountable to the law through the legal process.