We investigate cosmological perturbations of scalar-tensor
theories in Palatini formalism. First we introduce an action where
the Ricci scalar is conformally coupled to a function of a scalar
field and its kinetic term and there is also a k-essence term
consisting of the scalar and its kinetic term. This action has three
frames that are equivalent to one another: the original Jordan
frame, the Einstein frame where the metric is redefined, and the
Riemann frame where the connection is redefined. For the first time
in the literature, we calculate the quadratic action and the sound
speed of scalar and tensor perturbations in three different frames
and show explicitly that they coincide. Furthermore, we show that
for such action the sound speed of gravitational waves is
unity. Thus, this model serves as dark energy as well as an inflaton
even though the presence of the dependence of the kinetic term of a
scalar field in the non-minimal coupling, different from the case in
metric formalism. We then proceed to construct the L3 action called
Galileon terms in Palatini formalism and compute its
perturbations. We found that there are essentially 10 different
(inequivalent) definitions in Palatini formalism for a given
Galileon term in metric formalism. We also see that, in general, the
L3 terms have a ghost due to Ostrogradsky instability and the sound
speed of gravitational waves could potentially deviate from unity,
in sharp contrast with the case of metric formalism. Interestingly,
once we eliminate such a ghost, the sound speed of gravitational
waves also becomes unity. Thus, the ghost-free L3 terms in Palatini
formalism can still serve as dark energy as well as an inflaton,
like the case in metric formalism.